Displaying 1 result from an estimated 1 matches for "endroit_connu_id".
2006 May 01
0
Having trouble adding rows to an association
...s_connus,
:through => :endroits_photos
end
class EndroitsPhoto < ActiveRecord::Base
belongs_to :photo
belongs_to :endroits_connu
end
class EndroitsConnu < ActiveRecord::Base
has_many :endroits_photos,
:dependent => true,
:foreign_key => "endroit_connu_id"
has_many :photos,
:through => :endroits_photos,
:foreign_key => "endroit_connu_id"
end
this is the code used :
key = params[:post][:photo_id]
@photo =
EndroitsConnu.find(params[:endroit]).endroits_photos.create(:photo =>
Photo.find(key))
th...