I am adding devise to my Rails 5 app and when I go to /users/sign_in
I get this error:
No route matches {:action=>"email_signup", :controller=>"devise/jobs"}
The error is here:
<%= form_tag({controller: "jobs", action: "email_signup"}, method: "post") do %>
<%= text_field_tag(:email_address, nil, placeholder: 'Email Address') %>
<p><div class="button-wrap"><button data-dialog="maildialog" class="mailtrigger">Sign Me Up</button></div></p>
<% end %>
Seems like devise is trying to look for the route in the context of devises own route. What is the best way to fix this?
This helped me out: rails form_tag url path
I changed the form_tag to use the route rather than specifying the controller and that fixed the issue:
<%= form_tag(email_signup_jobs_path, method: "post") do %>
<%= text_field_tag(:email_address, nil, placeholder: 'Email Address') %>
<p><div class="button-wrap"><button data-dialog="maildialog" class="mailtrigger">Sign Me Up</button></div></p>
<% end %>