Hi all,
I have been experimenting a strange behaviour in a has_many :through
relationship when trying to use plugins like Active Scaffold and
Streamlined. They both show correctly the records of the relationship
but are not able to update/create/erase new records. I think Active
Scaffold has problems with this kind of relationships but Streamlined
should work properly…
My models are:
class Project < ActiveRecord::Base
set_primary_key ‘project_ID’
has_many :sample_to_projects, :foreign_key => ‘project_ID’
has_many :samples, :through => :sample_to_projects
end
class SampleToProject < ActiveRecord::Base
set_table_name ‘sample_to_project’
#composite_primary_keys plugin. I´ve tried also leaving just
projectID as
#primary key
set_primary_key :project_ID, :sample_ID
belongs_to :sample
belongs_to :project
end
class Sample < ActiveRecord::Base
set_primary_key ‘sample_ID’
has_many :sample_to_projects, :foreign_key => ‘sample_ID’
has_many :projects, :through => :sample_to_projects
belongs_to :source, :foreign_key => ‘source_ID’ // Just another
relation…
end
Thank you for your advice!