Reputation: 11
So I have a simple Rails form that is sent to controller admin
, action checkLogin
. If the credentials are correct, redirect the user to a new view called main.html.erb
. Now in my controller I have literally tried everything, from render 'main'
; to redirect_to
. But I keep getting the following error:
ActionView::MissingTemplate (Missing template admin/activate with {
:handlers=>[:rjs, :rhtml, :rxml, :builder, :erb],
:formats=>[:js, :"application/ecmascript", :"application/x-ecmascript", :"*/*"],
:locale=>[:en, :en]} in view paths "/home/xxx/xxx/xxx/rails/beta/app/views"
Is this a routing issue, or what?
Upvotes: 1
Views: 4902
Reputation: 16619
Have you add the 'checkLogin' to routes. try this, in your routes.rb
resources :admin do
member do
get 'checkLogin'
end
end
**NOTE : get 'checkLogin' might be post 'checkLogin' according to your case..
and inside your controller action 'checkLogin', render a partial
render :partial => 'main'
Upvotes: 0
Reputation: 43103
Try render :file => 'admin/main.html.erb'
to specify the exact file.
The problem is the render call is looking for a file that matches the name of your controller action, and it isn't finding it. So, specify the exact file and you should be ok.
FYI if you call render 'main'
then it will try to render the view associated with your "main" action, which may not work if you don't have a "main" action.
Also, be sure you mean to render. If you DO have a main action and you want the stuff that's defined in that action to happen then you need to redirect_to main_whatever_path
.
Upvotes: 1