NoMethodError:devise_invitable的未定义方法`with_indifferent_access'

时间:2014-05-15 10:39:02

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

我正在使用gem devise_invitable。我只想重新邀请用户。但是,对于这么简单的操作,我收到了一个错误:

[10] pry(#<MyController>)> @user = User.invite!("user1@test.com", current_user)
NoMethodError: undefined method `with_indifferent_access' for "user1@test.com":String
from /home/alex/.rvm/gems/ruby-2.1.1/gems/devise_invitable-1.3.3/lib/devise_invitable/model.rb:252:in `invite!'

我试图包含可能解决此问题的2个文件,但我不能,因为它们不存在:

[11] pry(#<MyController>)> require 'active_support/core_ext/hash'
=> false

[13] pry(#<MyController>)> require 'active_support/core_ext/hash/indifferent_access'
=> false

1 个答案:

答案 0 :(得分:1)

应该是:

@user = User.invite!({email: "user1@test.com"}, current_user)