我有一个表格,我正在创建一个新项目。
= form_for(@project, :html => { :class => 'addProjectForm' }) do |f|
#actions
= f.submit
%p
= f.label :name
%br
= f.text_field :name, :class => 'projectName'
%p
= f.label :ticket
%br
= f.text_field :ticket, :class => 'ticket'
%p
= f.label "Crew Member Name"
= f.label "Crew Member Role"
%br
= f.text_field :crew_members.name
= f.collection_select :crew, CrewMember.all, :role, :role
= f.submit "Add More Crew Members", :id => 'add-crew-member'
%p
在 :crew_members.name 之前一切正常。我不断得到一个undefined method "name" for :crew_member:Symbol
. 之前的所有标签都在更新 Project 表,但我无法让 CrewMembers 更新。这是模型。
class CrewMember < ActiveRecord::Base
attr_accessible :name, :role
belongs_to :project
end
我在这里先向您的帮助表示感谢。