简体   繁体   English

RoR使用设计 - 加密密码

[英]RoR using Devise - Encrypted Password

Hi pardon my ignorance but I'm new to RoR. 你原谅我的无知,但我是RoR的新手。 My problem is that I'm trying to make my Devise gem work but when I fill out the information and click Sign-Up, I get this in return: "undefined method `encrypted_password=' for". 我的问题是我正在尝试使我的Devise gem工作,但是当我填写信息并单击Sign-Up时,我得到了回报:“undefined method` encrypted_pa​​ssword ='for”。

I've already tried rake db:migrate and also clearing the attributes in the User.rb model but still it doesn't work. 我已经尝试过rake db:migrate并清除User.rb模型中的属性,但它仍然不起作用。

Please any guidance would be appreciated! 请任何指导,不胜感激!

This most likely means, that you are missing on migrations. 这很可能意味着您在迁移时缺失。 Are you sure, that you have setup devise right? 你确定,你有安装设计吗?

https://github.com/plataformatec/devise https://github.com/plataformatec/devise

rails generate devise:install
rails generate devise User
bundle exec rake db:migrate

In the rails console run, this will tell you if the migration has run 在rails控制台运行中,这将告诉您迁移是否已运行

User.new.respond_to?(:encrypted_password=)

This should return true, if not do 如果不这样做,这应该返回true

bundle exec rake db:migrate:reset

In the site railscasts.com you can watch: 在网站railcasts.com中,您可以观看:

http://railscasts.com/episodes/209-introducing-devise

after that you understand where you make a mistake If you then get an error - write comments and we help 在那之后你就会明白你犯了什么错误如果你得到错误 - 写下评论并且我们会帮助你

PS gem 'devise', '1.1.rc0' => gem 'devise' in gemfile 宝石文件中的宝石'设计','1.1.rc0'=>宝石'设计'

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM