Scuse me but, as the subject says, I'm not be able to set an extra attribute of a join model. Situation is:
class Company < ActiveRecord::Base has_many :managements has_many :managers, :through => :managements class Manager < ActiveRecord::Base has_many :managements has_many :companies, :through => :managements class Management < ActiveRecord::Base belongs_to :company belongs_to :manager ROLES = ["Rappresentante legale", "Titolare"].freeze Management has an extra attribute :role and the values are those in the ROLES array . I want create a Company; then add a Manager but, at the same time, set the :role attribute of Management join model. The form for creating a new Manager is: - args = @company.nil? ? [@manager] : [[@company, @manager], {:remote => true}] = semantic_form_for *args do |f| = f.inputs :name, :surname, :fiscal_code, :city, :zip_code, :address, :street_number, :tel, :email = f.semantic_fields_for :managements do |management| = management.inputs do = management.input :role, :as => :select, :collection => Management::ROLES = f.buttons :commit I don't see the role field. Manager controller is def new @company = Company.find(params[:company_id]) @manager = @company.managers.build def create @company = Company.find(params[:company_id]) @manager = Manager.new(params[:manager]) @manager.company_ids = @company.id I can add a Manager to @company but I don't know how to set the :role attribute. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.