Hi pardon my ignorance but I'm new to 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".
I've already tried rake db:migrate and also clearing the attributes in the User.rb model but still it doesn't work.
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
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
User.new.respond_to?(:encrypted_password=)
This should return true, if not do
bundle exec rake db:migrate:reset
In the site railscasts.com you can watch:
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
P.S. gem 'devise', '1.1.rc0' => gem 'devise' in gemfile
Related
I am following the railscast (#353 OAuth with Doorkeeper pro) and am stuck in setting up doorkeeper. Please see below:
In gemfile, I put gem 'doorkeeper' and then run bundle to install it
Next, I run the rails generate doorkeeper:migration, followed by rake db:migrate
I see a couple of rows of 'create_table' and 'add_index' as expected.
Here's the problem:
In my folder 'initializers', there is no doorkeeper.rb file. What did I miss?
Try this before you run doorkeeper:migration
rails generate doorkeeper:install
Am using devise gem for authentication
When i run rake db:migrate
I got the error mentioned below:
rake aborted!
User does not respond to 'devise' method.
This usually means you haven't loaded your ORM file or it's being loaded too late.
To fix it, be sure to require 'devise/orm/YOUR_ORM' inside 'config/initializers/devise.rb'
or before your application definition in 'config/application.rb'
If you know answer. Please let me know..
In the file config/initializers/devise.rb look for the line:
require 'devise/orm/active_record'
Make sure that it isn't commented out, and make sure it matches your orm.
If that file doesn't exist, then you haven't installed devise:
rails generate devise:install
Have a good read of the Getting Started instructions
I took the following steps:
rails new routing_test
in Gemfile I added devise
rails devise g user
invoke active_record
create db/migrate/20130731191051_devise_create_users.rb
create app/models/user.rb
invoke rspec
create spec/models/user_spec.rb
invoke factory_girl
create spec/factories/users.rb
insert app/models/user.rb
route devise_for :users
and then, with a simple rake db:migrate, I get the following:
rake aborted!
Rails::Application::RoutesReloader#execute_if_updated delegated to updater.execute_if_updated, but updater is nil: #<Rails::Application::RoutesReloader:0x007feb823b6120 #paths=["/Users/krg07/Developer/core2/test/dummy/config/routes.rb", "/Users/krg07/Developer/core2/config/routes.rb"], #route_sets=[#<ActionDispatch::Routing::RouteSet:0x007feb82c5e700>, #<ActionDispatch::Routing::RouteSet:0x007feb82d34440>]>
/Users/krg07/.rvm/gems/ruby-2.0.0-p247/gems/railties-4.0.0/lib/rails/application/routes_reloader.rb:10:in `rescue in execute_if_updated'
/Users/krg07/.rvm/gems/ruby-2.0.0-p247/gems/railties-4.0.0/lib/rails/application/routes_reloader.rb:6:in `execute_if_updated'
/Users/krg07/.rvm/gems/ruby-2.0.0-p247/gems/railties-4.0.0/lib/rails/application/finisher.rb:69:in `block in <module:Finisher>'
Any idea what is going on? Thanks, really appreciate it!
I had problems getting Devise to work with Rails 4 and found that most of the issues were because I was including an older version of the gem that was not updated to work with Rails 4. Specifying the latest version of the gem helped:
gem 'devise', '3.0.0'
You may need to re-run the Devise installer after the gem has been updated.
You are not the only one to have this problem, see the following issue for more informations.
I have added the Devise gem to the ruby on rails app version 1.8.7. I using devise to authenticate and also I have created a model called user which will connect another database, I have mentioned/specified the database configurations in the create_connection,whenever I run the app in the local host, I am getting this error message
"undefined method `password_salt=' for #"
As soon as I register a new member I am getting this error.
I am a newbie to rails,
Kindly help me out
i had this error once before, try the following
1.Re-run your migrations again
rake db:migrate VERSION=0 #to rollback migrations to the first one if needed<br />
Just in case you have forgotten, uncomment the following line
t.string :password_salt
then migrate your database
rake db:migrate
Also make sure that encryptable is added to your database model
devise :encryptable .....
2.Update your devise gem
bundle update or specify in your gem file to use latest devise gem 2.x
You will need to add the password_salt column to your users table. It appears to be missing.
I'm trying to get Devise working. I'm following this tutorial which tells me to do "rails generate devise User" but when I do that command, it gives me an error saying
"NameError: uninitialized constant User from /var/lib/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2503:in `const_missing'"
What am I doing wrong? I'm using Rails 3.0.9, Ruby 1.8.7 and Ubuntu 11.04
Thanks a bunch in advance,
Michael.
Do you have gem devise in your Gemfile? Then, run bundle install. You can also try putting require 'devise' in your config/application.rb file (but you shouldn't have to do this).