Having trouble adding rows to an association

hi everybody, when trying to add rows to a join table i get the
following error :
sequence doesn’t exist

here are the models used

class Photo < ActiveRecord::Base
has_many :endroits_photos,
:dependent => true

has_many :endroits_connus,
:through => :endroits_photos

class EndroitsPhoto < ActiveRecord::Base
belongs_to :photo
belongs_to :endroits_connu

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”

this is the code used :

key = params[:post][:photo_id]
@photo =
EndroitsConnu.find(params[:endroit]).endroits_photos.create(:photo =>

the main problem is that rails searchs a sequence for the joind table
and such a sequence doesn’t exist !!

if the someone catch the problem , it would be great !!


This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs