ruby on rails - both refer to the table from another scope? -


help solve problem.

i generated scaffold:

rails g scaffold user 

the result was:

class userscontroller < applicationcontroller   def index     @users = user.paginate(page: params[:page], :per_page => 7)       end    .....   .....   ..   ... end 

then generated:

rails g scaffold admin/user 

the result was:

class admin::userscontroller < applicationcontroller   layout 'adminpanel'    def index     @users = user.all   end    ....   ....   .... end 

views/admin/users/index.html.erb:

<pre>   <%= debug @users %> </pre> 

as result following error message:

nameerror in admin::userscontroller#index uninitialized constant admin::userscontroller::user request parameters: none 

try changing below in index method

@users = user.all 

to

@users = ::user.all 

Comments

Popular posts from this blog

android - Gradle sync Error:Configuration with name 'default' not found -

java - Andrioid studio start fail: Fatal error initializing 'null' -

html - jQuery UI Sortable - Remove placeholder after item is dropped -