문제

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?

도움이 되었습니까?

해결책

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.

다른 팁

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
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top