Tamik Soziev
Tamik Soziev

Reputation: 14798

Rails resources routes for admin namespace, error when generating a form

I have an admin namespace in routes with users controller:

namespace :admin do
   resources :users
end

So i have users_controller.rb in /admin folder, and a User model. In my _form partial i am trying to create a form for both new and edit actions, but when i try to create it using this:

= simple_form_for @user do |f|

I am receiving in error in both edit and new actions:

ActionView::Template::Error (undefined method `user_path' for...

Upvotes: 0

Views: 687

Answers (1)

Santosh
Santosh

Reputation: 1261

Just try in the form with,

= simple_form_for [:admin, @user] do |f|

Upvotes: 4

Related Questions