尝试创建新用户时未定义的方法`with_scope'

时间:2015-03-08 02:37:00

标签: ruby-on-rails ruby ruby-on-rails-4

尝试创建新用户时遇到问题。 当我点击创建时, 未定义的方法`with_scope'为# 这就出现了。

  @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'

我不知道为什么以及什么时候我会用'_s;'在整个文件夹下,我没有看到任何文件中存在这样的功能。 我也试图放弃,并重新创建整个数据库。但它仍然没有用。

1 个答案:

答案 0 :(得分:0)

with_scope是一个ActiveRecord方法。您将无法在源代码中找到它。转到Rails控制台并重现该问题。您也可以@user.errors.full_messsages检查错误消息。