简体   繁体   中英

undefined method `with_scope' when trying to create new user

I encounter a problem when trying to create a new user . When I click on create, undefined method `with_scope' for # this shows up.

  @user.timezonepref = User.find(@user.parent_id).timezonepref

  if @user.save


    The error console shows that the problem is in the line 'if @user.save'

I don't know why and when I grep for 'with_scope' under the whole folder , I don't see such function exists in any file. And I also tried to drop, and re-create the whole database. But it is still not working.

The with_scope is an ActiveRecord method. You will not find it in your source code. Go to Rails console and reproduce the problem. You can also do @user.errors.full_messsages to check for error messages.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM