NoMethodError:未定义的方法`确认!'对于#<user

时间:2016-08-01 08:00:02

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

=“”

我正在尝试使用rails app composer工具创建应用。我正在使用Devise confirmable。我收到错误

rake db:seed
rake aborted!
NoMethodError: undefined method `confirm!' for #<User:0xa0b26ec>

在安装过程中。

user.rb文件已有:confirmable

  devise :database_authenticatable, :registerable, :confirmable,
     :recoverable, :rememberable, :trackable, :validatable

我无法rake db:seed

2 个答案:

答案 0 :(得分:12)

#confirm!方法已被删除。

https://github.com/plataformatec/devise/commit/26e22d8e953184b38a87f3a9b935db32258637d5

您必须使用旧版本,或者更好地切换到#confirm方法。

答案 1 :(得分:6)

Devise 4.2.0已强制 confirm!方法,您必须使用confirm代替

4.2.0 - 2016-07-01

删除: -

Remove the deprecated Devise::ParameterSanitizer API from Devise 3. Please use the #permit and #sanitize methods over #for.

Remove the deprecated OmniAuth URL helpers. Use the fully qualified helpers (user_facebook_omniauth_authorize_path) over the scope based helpers ( user_omniauth_authorize_path(:facebook)).

Remove the Devise.bcrypt method, use Devise::Encryptor.digest instead.

Remove the Devise::Models::Confirmable#confirm! method, use confirm instead.

Remove the Devise::Models::Recoverable#reset_password! method, use reset_password instead.

Remove the Devise::Models::Recoverable#after_password_reset method.

从此,

<强> Remove the Devise::Models::Confirmable#confirm! method, use confirm instead.

Here is the refference