I have 'User' model class (app/models/user.rb)
This class works at any controller except in specially namespace.
for example,
app/controllers/chimiseng/user_controller.rb - User model works! app/controllers/chimiseng/*_controller.rb - works all!
app/controllers/nadmin/* - User model not works in any controller.
app/controllers/nadmin/partner/account_controller.rb
app/controllers/nadmin/log_controller.rb
..
..
error message :
NoMethodError in Nadmin::Partner::AccountController#index
undefined method `where' for Nadmin::User:Module
14: @users = User.where("info_update = true")
and then if refresh, error message change,
NameError in Nadmin::Partner::AccountController#index
uninitialized constant Nadmin::Partner::AccountController::User
14: @users = User.where("info_update = true")
and
logger.debug User.class # => "Module"
I have no module User.
There is only class User < ActiveRecored::Base (app/models/user.rb)
Why this error appear ? Why User.class is Module ?
(logger.debug AnyModel.class # => "Class")
I really want to know..
Rails version 4.1.4
ruby 2.2.0p0 (2014-12-25 revision 49005)
++Edited (2015-07-14 11:53 am (+09:00))
#nadmin/partner/account_controller.rb#index action
15: logger.debug User.ancestors
16: @user = User.where("info_update = true")
when server start first, and request this action. error "uninitialized constant Nadmin::Partner::AccountController::User" by line 16. and log print "[Nadmin::User]" by line 15
But! after refresh, error line change into 15.
error "uninitialized constant Nadmin::Partner::AccountController::User" by line 15. (of course, no logging because line logging is error line)
And Repeat refresh again, error line keep 15. error message is same.
15: logger.debug User.class
16: @user = User.where("info_update = true")
is same status above.
(when server start first, and request this action. error "uninitialized constant Nadmin::Partner::AccountController::User" by line 16.
and log print "Module" by line 15
But! after refresh, error line change into 15.
error "uninitialized constant Nadmin::Partner::AccountController::User" by line 15.
And Repeat refresh again, error line keep 15. error message is same.)