Forum: Ruby on Rails Creating & Validating w/ has_many :through

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-27 18:58
I don't have a full grasp on has_many :through associations.  I've
detailed my models below and am trying to figure out how to do the
following in the proper manner.

1. Add the selected software (only one selectable) to the current
ticket.  I have @ticket.software << @software working just fine.
2. Validate that A) 1 or more systems have been selected, B) A
:software_status has been selected.  I'm not sure where these
validations should go.
3. Create the software to system association (w/ sofware_status value)
through the join model
4. How to setup the new/edit form to manage all of this.

Thanks in advance.

Ticket.rb

has_and_belongs_to_many :software

Software.rb

has_many :system_software
has_many :systems, :through => :system_software

System.rb

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

SystemSoftware.rb

belongs_to :system
belongs_to :software
belongs_to :software_status

SoftwareStatus.rb

has_many :system_software
This topic is locked and can not be replied to.