Reputation: 7249
I have a form like this
<%= form_tag organizations_add_user_path, :method => :put do %>
<label><h2>Add user</h2></label>
<%= text_field_tag :nick %>
<% end %>
I want this form to process the action add_user
from Organizations
controller
My routes are this
resources :users, :sessions, :documents, :storages, :organizations
match 'dashboard' => 'dashboard#index'
match 'profile' => 'users#profile'
match 'organizations/add_user' => 'organizations#add_user', :via => :post
But when I submit my form, the app sends me to update
method form organizations, with Organization id as add_user
. What am I doing wrong?
Upvotes: 0
Views: 72
Reputation: 2512
You have defined a route for 'post' method but used 'put' method in the form.
<%= form_tag organizations_add_user_path, :method => :post do %>
<label><h2>Add user</h2></label>
<%= text_field_tag :nick %>
<% end %>
Upvotes: 1