Reputation: 1606
I've worked a bit on Rails before but this is the first time I'm working on Rails 4 (not that I believe its the problem).
I have the following routes in my routes.rb
match "/admin/login" => "admin#login", :as => :admin_login, :via => [:get,:post]
When I visit /admin/login, the file at admin/login.html.erb renders properly. But when I do a redirection like -
redirect_to :admin_login
I get an error -
Missing template admin/admin_login, application/admin_login
Can someone help me with this?
Upvotes: 2
Views: 2004
Reputation: 6015
The :as option forms a named route.
Usually it's used in a non-root route.
Try this
redirect_to admin_login_path
admin_login_path
and admin_login_url
are defined because of the :as
Upvotes: 2