Ruby on rails 如何使用用户身份验证(Monban)在seeds.rb中创建测试用户

Ruby on rails 如何使用用户身份验证(Monban)在seeds.rb中创建测试用户,ruby-on-rails,ruby-on-rails-3,Ruby On Rails,Ruby On Rails 3,我正在使用Monban进行用户身份验证,并希望在seeds.rb中创建一个用于开发的测试用户。目前我在seeds.rb中有以下内容: include Monban::ControllerHelpers #I tried with and without this @user = sign_up({name: 'foo', email: 'foo@bar.com', password: '123'}) 到目前为止还不能让它工作。当您需要使用Monban之类的工具“摘要”密码时,如何创建

我正在使用Monban进行用户身份验证,并希望在seeds.rb中创建一个用于开发的测试用户。目前我在seeds.rb中有以下内容:

include Monban::ControllerHelpers      #I tried with and without this
@user = sign_up({name: 'foo', email: 'foo@bar.com', password: '123'})

到目前为止还不能让它工作。当您需要使用Monban之类的工具“摘要”密码时,如何创建测试用户?

您可以使用注册服务对象

如果你想让它看起来更好,你可以自己定义注册方法

def sign_up(user_params)
  SignUp.new(user_params).perform
end

希望这有帮助!如果您有任何其他与Monban相关的问题,请告诉我。

您看到的错误是什么?Object:Class的未定义方法“helper\u method”作为旁白,我可能会将这些从controller\u helpers目录移动到services目录。他们在这里的名字肯定错了。
def sign_up(user_params)
  SignUp.new(user_params).perform
end