Skip to content

Instantly share code, notes, and snippets.

@rkellermeyer
Created September 19, 2012 01:00
Show Gist options
  • Save rkellermeyer/3747017 to your computer and use it in GitHub Desktop.
Save rkellermeyer/3747017 to your computer and use it in GitHub Desktop.
Form Nested on non-Modal view
Routing Error
No route matches {:action=>"new", :controller=>"messages"}
Try running rake routes for more information on available routes.
# ...
belongs_to :user
# ...
# ...
resources :users do
resources :messages
end
# ...
# In app/views/users/show.html.erb
<div class="formInputWrapper">
<%= semantic_form_for [@user,@message] do |f| %>
<%= f.input :content, id: "newMessageInput" %>
<%= f.button_tag(type: 'button', class: "messageSubmit") do %>
<%= image_tag("chatSubmit.png") %>
<% end %>
<% end %>
</div>
# ...
attribute_accessible :message_attributes # ...
has_many :messages
accepts_nested_attributes_for :messages
# ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment