私は次のユーザーモデルを持っています:
class User < ActiveRecord::Base
has_many :competences
has_many :skills, :through => :competences
accepts_nested_attributes_for :skills
end
および次のスキル モデル:
class Skill < ActiveRecord::Base
has_many :competences
has_many :users, :through => :competences
end
コンピテンス モデルには「タイプ」属性があり、結合モデルです。ネストされたフォーム内で、送信したスキルを保存するときに「type」属性を設定するにはどうすればよいですか? ネストされたフォームは次のとおりです。
<% f.fields_for :skills do |s| %>
<%= s.text_field :name %>
<% end %>