In the Rails documentation, we find the following example:
class Physician < ActiveRecord::Base
has_many :appointments
has_many :patients, :through => :appointments
end
I’m just curious: is it possible to generate this via the command line using rails generate model?
Not according to the usage message you get from
rails generate model. You can set up abelongs_torelationship, though:Gives me the following in
app/models/photo.rb: