I'm trying to have a message saved to my campaign class but the text field isn't showing up. I've tried a few different variations but can't seem to get it to work. I put a debugger in the fields_for and the code doesn't even get down to that logic. Here's the code:
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'
why wouldn't the text_area be showing on the page?
Try @campaign.build_message
in new action or @campaign.messages.new