Displaying 1 result from an estimated 1 matches for "thread_form".
2009 May 12
2
2.3 Nested Model Forms; build new without updating existing
...ested_attributes_for :messages, :allow_destroy => true
end
class Message < ActiveRecord::Base
belongs_to :message_threads
end
View (show.html.erb)
<% @message_thread.messages.each do |message| %>
<%= message.message %>
<% end %>
<% form_for @message_thread do |thread_form| -%>
<% thread_form.fields_for :messages do |message| %>
<%= message.label :message %>
<%= message.text_field :message %>
<% end %>
<%= submit_tag ''Send Message'' %>
<% end -%>
Thanks.