Reputation: 48606
it's been quite some time since i last wrote Rails and i've forgotten some stuff i guess :P I'm having a simple has_many through but i can't get create_association to work for some reason. The models are :
class City < ActiveRecord::Base
has_many :city_buildings
has_many :buildings, :through => :city_buildings
class CityBuilding < ActiveRecord::Base
belongs_to :city
belongs_to :building
end
I write something like :
c = City.first
c.create_building
and i get :
NoMethodError: undefined method `create_building' for #<City:0x007f9a8f9494f0>
Why do i get that ? Any idea ?
Upvotes: 3
Views: 810