Forum: Ruby on Rails Setting attributes on a has_many through relationship

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Eric M. (Guest)
on 2009-04-24 22:01
(Received via mailing list)
The has_many through setup detailed below allows me to do
@system.software << and @software.systems << for establishing the
relationships, using an array of software or system objects,
respectively.  This works out well because my form for software has a
software_ids multi-select.  The problem I have is that the join model
has additional attributes to store.  Can I use the above method and
somehow also include the additional attributes or do I have to do x =
SystemSoftware.new... x.system_status = SystemStatus.find(params
[:system_status_id]...etc.?


System.rb

has_many :system_software
has_many :software, :through => :system_software

Software.rb

has_many :system_software
has_many :software, :through => :system_software

SystemSoftware.rb

belongs_to :system
belongs_to :software
This topic is locked and can not be replied to.