# Problems with :through and scaffolding

**URL:** <https://www.ruby-forum.com/t/problems-with-through-and-scaffolding/118821>\
**Category:** Rails\
**Created:** [October 31, 2007, 11:43am UTC](https://www.ruby-forum.com/t/problems-with-through-and-scaffolding/118821 "2007-10-31T11:43:08Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![kabish](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/k/a88e57/32.png) [@kabish](https://www.ruby-forum.com/u/kabish)\
**Post date:** [October 31, 2007, 11:43am UTC](https://www.ruby-forum.com/t/problems-with-through-and-scaffolding/118821/1 "2007-10-31T11:43:08Z")

</div>

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!
