我正在尝试将消息保存到我的活动类,但文本字段未显示。我尝试了一些不同的变化,但似乎无法让它发挥作用。我在 fields_for 中放置了一个调试器,代码甚至没有深入到那个逻辑。这是代码:
def new
@campaign = Campaign.new
@message = Message.new(:campaign_id => @campaign.id)
end
def edit
@campaign = Campaign.find(params[:id])
@message = @campaign.message
end
%legend
Enter the campaign information
.field
.control-group
%label.control-label
Campaign Name
.controls
= f.text_field :name
= f.collection_select(:group_id, current_user.groups.all, :id, :name, :include_blank => true)
= f.fields_for :message do |m|
= m.text_area :body, :rows => 3
.form-actions= f.submit "#{params[:action] == 'new' ? 'Create New Campaign' : 'Save Campaign'}", :class => 'btn btn-success'
为什么 text_area 不会显示在页面上?