When trying to create a new user manually, the error "undefined method `generate_token'" is thrown.
The code doing this worked in previous versions:
user = User.new(email: email, password: Devise.friendly_token[0,20])
user.skip_confirmation!
valid_user = user.save #<--- error occurs here during .save
I'm using these versions in the Gemfile:
ruby '2.0.0'
gem 'rails', '4.0.0'
gem 'devise', '~> 3.1.1'
gem 'devise_uid', '~> 0.0.3'
The user.rb Devise model has these modules:
devise :database_authenticatable, :registerable, :recoverable, :rememberable, :trackable, :validatable, :confirmable, :lockable, :timeoutable, :uid
It turns out the issue was with the devise_uid gem. I created a pull request for it ( https://github.com/jingweno/devise_uid/pull/2 ) and it has already been accepted, so anyone else having this issue should upgrade to 0.0.4.
It seems like this error was fixed lately: See this github issue .
If it still doesn't work, try removing the :rememberable
attribute.
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.