dimanche 10 décembre 2017

No route matches [POST] form not working

I have the following in create_admin.html.erbwhich is located in the directory view/create_admin

<div id="page_wrapper">
    <p>Please insert the usernumber of the user that you want to make admin</p>
    <%= form_tag "/controllers/create_admin_controller" do %>
      <%= text_field_tag "account" %> <br/> <br/>
      <%= submit_tag "Make admin" %>
    <% end %>         
</div>

In the create_admin_controller.rb , I have the following:

def update 
end

In the routes.rb I have the following:

 match "/app/views/createAdmin/create_admin.html.erb" => "create_admin#create_admin", :via => :post, :as => :update

Yet I am getting routing error

No route matches [POST] "/controllers/create_admin_controller"

What am I doing wrong ?

Thanks for your time

Aucun commentaire:

Enregistrer un commentaire