I installed Devise to get authentication into my application. I followed all the instructions about the gem and that part seemed to go well.
However now that I am trying to link to the Register page, I get a crazy error I can't figure out... For some reason, rails can't figure out where the devise controllers are located...
from: public/index.html.erb (public landing page)
<div class ="getstarted">
<table>
<tr>
<td id = "introtext">
<p>Foo is good..l here is why: </p>
<ul>
<li>Improved quality</li>
<li>Technology consistencies </li>
<li>Cost efficiencies</li>
<li>Increased security</li>
<li>Improved adherence to compliance standards</li>
</ul>
</td>
<td id = "buttons">
<%= button_to "Sign Up for an Account", new_user_registration_path, :method => "get" %>
<br/>
<%= button_to "Log In to your Account", new_user_session_path, :controller => "devise/session", :method => "get" %>
</td>
</tr>
</table>
</div>
routes.rb has the following line:
devise_for :users
and the Routes table seems to have what it needs:
new_user_session GET /users/sign_in(.:format) devise/sessions#new
user_session POST /users/sign_in(.:format) devise/sessions#create
destroy_user_session DELETE /users/sign_out(.:format) devise/sessions#destroy
user_password POST /users/password(.:format) devise/passwords#create
new_user_password GET /users/password/new(.:format) devise/passwords#new
edit_user_password GET /users/password/edit(.:format) devise/passwords#edit
PUT /users/password(.:format) devise/passwords#update
cancel_user_registration GET /users/cancel(.:format) devise/registrations#cancel user_registration POST /users(.:format) devise/registrations#create new_user_registration GET /users/sign_up(.:format) devise/registrations#new edit_user_registration GET /users/edit(.:format) devise/registrations#edit PUT /users(.:format) devise/registrations#update DELETE /users(.:format) devise/registrations#destroy
When I click on the button to register I go to the link:
http://localhost:3000/users/sign_up?
and Rails gives me the error:
No route matches {:controller=>"devise/public"}
Same thing for the log-in button:
http://localhost:3000/users/sign_in?
No route matches {:controller=>"devise/public"}
I set up a view for "public" to be my public viewable (pre authentication) pages... and I see that Rails is looking for that inside the devise directory (which doesn't exist).
I also tried deleting the ? at the end of the URL... that didn't produce any difference.
I'm stuck and a couple hours already invested. Hope someone can help me out.
:method
or the:controller
in your links above unless you have overridden the Devise controllers. (2) have you restarted your server since implementing Devise? – vich<% if current_page?(:controller => 'public') %> < div class = "container2"> <% else %> <div class="container"> <% end %>
It seems that this is setting the controller to "public" - if I remove this logic, it works fine. – Dennis Stevenson