Question

I have a controller which is placed in /users/account_controller.rb

The route for that is: resources :account controller: 'users/account'

And in the view I have the account folder under view not under users

Now when I try to access new on account is looking for the template users/account/new how can I point that to account/new?

Was it helpful?

Solution

You probably may have two options(could be more)

1.Move the account_controller.rb from the users and put it under app/controllers directory. And change your route to resources :account.

OR

2.Just Place your account folder in views under users.

OTHER TIPS

If you just want to render a specific view in a non-RESTFUL manner, you can just tell rails what to render at the end of your method:

#account_controller.rb
def new
.
.
render 'account/new'
end
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top