In my newly created Rails 4 app, I suddenly hit rails g devise install instead of rails g devise:install. After this mistake, devise components for install are generated as I understood from this output:
invoke active_record
create db/migrate/20130921224627_devise_create_installs.rb
create app/models/install.rb
insert app/models/install.rb
route devise_for :installs
When I try to roll it back like rails d migration install, it failed because of not being set config.secret_key in devise.rb, but there was no file named it, too. I can't run rails g devise:install even creating devise.rb file and adding secret key configuration. After this process, here's another error occured:
/home/ekrem/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/railties-4.0.0/lib/rails/application/routes_reloader.rb:10:in `rescue in execute_if_updated': Rails::Application::RoutesReloader#execute_if_updated delegated to updater.execute_if_updated, but updater is nil: #<Rails::Application::RoutesReloader:0x007f6c66a67848 #paths=["/home/ekrem/workspace/contactman4/config/routes.rb"], #route_sets=[#<ActionDispatch::Routing::RouteSet:0x007f6c66ac1c80>]> (RuntimeError)
from /home/ekrem/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/railties-4.0.0/lib/rails/application/routes_reloader.rb:6:in `execute_if_updated'
from /home/ekrem/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/railties-4.0.0/lib/rails/application/finisher.rb:69:in `block in <module:Finisher>'
from /home/ekrem/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/railties-4.0.0/lib/rails/initializable.rb:30:in `instance_exec'
from /home/ekrem/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/railties-4.0.0/lib/rails/initializable.rb:30:in `run'
from /home/ekrem/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/railties-4.0.0/lib/rails/initializable.rb:55:in `block in run_initializers'
from /home/ekrem/.rbenv/versions/2.0.0-p247/lib/ruby/2.0.0/tsort.rb:150:in `block in tsort_each'
from /home/ekrem/.rbenv/versions/2.0.0-p247/lib/ruby/2.0.0/tsort.rb:183:in `block (2 levels) in each_strongly_connected_component'
from /home/ekrem/.rbenv/versions/2.0.0-p247/lib/ruby/2.0.0/tsort.rb:219:in `each_strongly_connected_component_from'
from /home/ekrem/.rbenv/versions/2.0.0-p247/lib/ruby/2.0.0/tsort.rb:182:in `block in each_strongly_connected_component'
from /home/ekrem/.rbenv/versions/2.0.0-p247/lib/ruby/2.0.0/tsort.rb:180:in `each'
from /home/ekrem/.rbenv/versions/2.0.0-p247/lib/ruby/2.0.0/tsort.rb:180:in `each_strongly_connected_component'
from /home/ekrem/.rbenv/versions/2.0.0-p247/lib/ruby/2.0.0/tsort.rb:148:in `tsort_each'
from /home/ekrem/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/railties-4.0.0/lib/rails/initializable.rb:54:in `run_initializers'
from /home/ekrem/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/railties-4.0.0/lib/rails/application.rb:215:in `initialize!'
from /home/ekrem/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/railties-4.0.0/lib/rails/railtie/configurable.rb:30:in `method_missing'
from /home/ekrem/workspace/contactman4/config/environment.rb:5:in `<top (required)>'
from /home/ekrem/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/activesupport-4.0.0/lib/active_support/dependencies.rb:228:in `require'
from /home/ekrem/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/activesupport-4.0.0/lib/active_support/dependencies.rb:228:in `block in require'
from /home/ekrem/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/activesupport-4.0.0/lib/active_support/dependencies.rb:213:in `load_dependency'
from /home/ekrem/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/activesupport-4.0.0/lib/active_support/dependencies.rb:228:in `require'
from /home/ekrem/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/railties-4.0.0/lib/rails/application.rb:189:in `require_environment!'
from /home/ekrem/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/railties-4.0.0/lib/rails/commands.rb:45:in `<top (required)>'
from bin/rails:4:in `require'
from bin/rails:4:in `<main>'
How can I correct this mistake?
There're couple ways around that, but I prefer to just remove everything that generator created.
the migration
the model
the route
I don't see you running the rake db:migrate command, so the migration might not be commited. If it is , run rake db:rollback wich will rollback the last migration.
One last thought for you. You should really learn how to use Git (or any other VCS you prefer). 'Cause it's exactly on of the problems that a VCS is designed to solve.
Related
I can't migrate new columns in my database via the terminal and RoR.
I only get the first step:
**$ rails g migration add_online_to_posts online:boolean**
Running via Spring preloader in process 13406
invoke active_record
create db/migrate/20170808141302_add_online_to_posts.rb
Afterwards nothing works:
**$ rails db:migrate**
rails aborted!
ActiveRecord::DuplicateMigrationVersionError:
Multiple migrations have the version number 20170725122210.
/home/projets/RoR_formation/vendor/bundle/gems/activerecord-5.1.2/lib/active_record/migration.rb:1257:in `validate'
/home/projets/RoR_formation/vendor/bundle/gems/activerecord-5.1.2/lib/active_record/migration.rb:1123:in `initialize'
/home/projets/RoR_formation/vendor/bundle/gems/activerecord-5.1.2/lib/active_record/migration.rb:1007:in `new'
/home/projets/RoR_formation/vendor/bundle/gems/activerecord-5.1.2/lib/active_record/migration.rb:1007:in `up'
/home/projets/RoR_formation/vendor/bundle/gems/activerecord-5.1.2/lib/active_record/migration.rb:985:in `migrate'
/home/projets/RoR_formation/vendor/bundle/gems/activerecord-5.1.2/lib/active_record/tasks/database_tasks.rb:171:in `migrate'
/home/projets/RoR_formation/vendor/bundle/gems/activerecord-5.1.2/lib/active_record/railties/databases.rake:58:in `block (2 levels) in <top (required)>'
/home/projets/RoR_formation/vendor/bundle/gems/railties-5.1.2/lib/rails/commands/rake/rake_command.rb:21:in `block in perform'
/home/projets/RoR_formation/vendor/bundle/gems/railties-5.1.2/lib/rails/commands/rake/rake_command.rb:18:in `perform'
/home/projets/RoR_formation/vendor/bundle/gems/railties-5.1.2/lib/rails/command.rb:46:in `invoke'
/home/projets/RoR_formation/vendor/bundle/gems/railties-5.1.2/lib/rails/commands.rb:16:in `<top (required)>'
/home/projets/RoR_formation/bin/rails:9:in `require'
/home/projets/RoR_formation/bin/rails:9:in `<top (required)>'
/home/projets/RoR_formation/vendor/bundle/gems/spring-2.0.2/lib/spring/client/rails.rb:28:in `load'
/home/projets/RoR_formation/vendor/bundle/gems/spring-2.0.2/lib/spring/client/rails.rb:28:in `call'
/home/projets/RoR_formation/vendor/bundle/gems/spring-2.0.2/lib/spring/client/command.rb:7:in `call'
/home/projets/RoR_formation/vendor/bundle/gems/spring-2.0.2/lib/spring/client.rb:30:in `run'
/home/projets/RoR_formation/vendor/bundle/gems/spring-2.0.2/bin/spring:49:in `<top (required)>'
/home/projets/RoR_formation/vendor/bundle/gems/spring-2.0.2/lib/spring/binstub.rb:31:in `load'
/home/projets/RoR_formation/vendor/bundle/gems/spring-2.0.2/lib/spring/binstub.rb:31:in `<top (required)>'
/home/projets/RoR_formation/bin/spring:15:in `<top (required)>'
bin/rails:3:in `load'
bin/rails:3:in `<main>'
Tasks: TOP => db:migrate
I can handle columns via the IDE:
But when I do :
**$ Status Migration ID Migration Name**
up 20170725122210 Create posts table
up 20170726082500 Rename post title to intitule
up 20170728143925 Create categories
up 20170807110617 ********** NO FILE **********
down 20170808113533 Add slug to posts
You've already run a migration with the prefix 20170725122210 (and it looks like you may have also deleted it). For a quick fix, change your newest migration to 20170725122211 (or any other number that isn't in your schema migrations table). You may also want to run rails db:schema:dump and inspect the output of db/schema.rb for tables that are not present in your migrations.
I am completely newby in Ruby and I am following the tutorial made by Michael Hartl.
In Chapter 2, Page 49, the book indicates:
rails generate scaffold User name:string email:string
After execute this, the application shows:
C:\demo_app>rails generate scaffold User name:string email:string
C:/demo_app/config/environments/development.rb:1:in `<top (required)>': undefine
d method `configure' for #<DemoApp::Application:0x35d3d98> (NoMethodError)
from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/activesupport-
3.2.3/lib/active_support/dependencies.rb:251:in `require'
from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/activesupport-
3.2.3/lib/active_support/dependencies.rb:251:in `block in require'
from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/activesupport-
3.2.3/lib/active_support/dependencies.rb:236:in `load_dependency'
from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/activesupport-
3.2.3/lib/active_support/dependencies.rb:251:in `require'
from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/railties-3.2.3
/lib/rails/engine.rb:571:in `block in <class:Engine>'
from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/railties-3.2.3
/lib/rails/initializable.rb:30:in `instance_exec'
from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/railties-3.2.3
/lib/rails/initializable.rb:30:in `run'
from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/railties-3.2.3
/lib/rails/initializable.rb:55:in `block in run_initializers'
from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/railties-3.2.3
/lib/rails/initializable.rb:54:in `each'
from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/railties-3.2.3
/lib/rails/initializable.rb:54:in `run_initializers'
from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/railties-3.2.3
/lib/rails/application.rb:136:in `initialize!'
from C:/demo_app/config/environment.rb:5:in `<top (required)>'
from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/railties-3.2.3
/lib/rails/application.rb:103:in `require'
from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/railties-3.2.3
/lib/rails/application.rb:103:in `require_environment!'
from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/railties-3.2.3
/lib/rails/commands.rb:25:in `<top (required)>'
from bin/rails:4:in `require'
from bin/rails:4:in `<main>'
I have already use bundle install, bundle update, installed new (and old) version of gems...
Could someone oriented me about what is wrong?
Or a way to avoid this mistake in order to follow with the next steps.
Thanks,
Try this:
bundle exec rails generate scaffold User name:string email:string
I solved the problem.
The steps were:
Correct the file development.rb including in the first line DemoApp::Application.configure do
Later I found another problem when I tried to execute rails generate scaffold User name:string email:string.
The description of the problem was:
C:\demo_app>rails generate scaffold User name:string email:string
invoke active_record
C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/activerecord-3.2.3/lib/acti
ve_record/dynamic_matchers.rb:50:in method_missing': undefined methodmigratio
n_error=' for ActiveRecord::Base:Class (NoMethodError)
Finally, I deleting the following line in config/environments/development.rb:
config.active_record.migration_error = :page_load
I used a mix between the next answers:
rake aborted! undefined method `migration_error=' for ActiveRecord::Base:Class
Error launching Rails server: undefined method 'configure'
I'd like to generate some devise views for an application, but whenever I try to use the command rails g devise:views, I get a complex error, well above my understanding.
/Users/michaeldunnegan/.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': Rails::Application::RoutesReloader#execute_if_updated delegated to updater.execute_if_updated, but updater is nil: #<Rails::Application::RoutesReloader:0x007ff613f5bb10 #paths=["/Users/michaeldunnegan/projects/SoundShare/config/routes.rb"], #route_sets=[#<ActionDispatch::Routing::RouteSet:0x007ff6168369e0>]> (RuntimeError)
from /Users/michaeldunnegan/.rvm/gems/ruby-2.0.0-p247/gems/railties-4.0.0/lib/rails/application/routes_reloader.rb:6:in `execute_if_updated'
from /Users/michaeldunnegan/.rvm/gems/ruby-2.0.0-p247/gems/railties-4.0.0/lib/rails/application/finisher.rb:69:in `block in <module:Finisher>'
from /Users/michaeldunnegan/.rvm/gems/ruby-2.0.0-p247/gems/railties-4.0.0/lib/rails/initializable.rb:30:in `instance_exec'
from /Users/michaeldunnegan/.rvm/gems/ruby-2.0.0-p247/gems/railties-4.0.0/lib/rails/initializable.rb:30:in `run'
from /Users/michaeldunnegan/.rvm/gems/ruby-2.0.0-p247/gems/railties-4.0.0/lib/rails/initializable.rb:55:in `block in run_initializers'
from /Users/michaeldunnegan/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/tsort.rb:150:in `block in tsort_each'
from /Users/michaeldunnegan/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/tsort.rb:183:in `block (2 levels) in each_strongly_connected_component'
from /Users/michaeldunnegan/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/tsort.rb:219:in `each_strongly_connected_component_from'
from /Users/michaeldunnegan/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/tsort.rb:182:in `block in each_strongly_connected_component'
from /Users/michaeldunnegan/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/tsort.rb:180:in `each'
from /Users/michaeldunnegan/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/tsort.rb:180:in `each_strongly_connected_component'
from /Users/michaeldunnegan/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/tsort.rb:148:in `tsort_each'
from /Users/michaeldunnegan/.rvm/gems/ruby-2.0.0-p247/gems/railties-4.0.0/lib/rails/initializable.rb:54:in `run_initializers'
from /Users/michaeldunnegan/.rvm/gems/ruby-2.0.0-p247/gems/railties-4.0.0/lib/rails/application.rb:215:in `initialize!'
from /Users/michaeldunnegan/.rvm/gems/ruby-2.0.0-p247/gems/railties-4.0.0/lib/rails/railtie/configurable.rb:30:in `method_missing'
from /Users/michaeldunnegan/projects/SoundShare/config/environment.rb:4:in `<top (required)>'
from /Users/michaeldunnegan/.rvm/gems/ruby-2.0.0-p247/gems/activesupport-4.0.0/lib/active_support/dependencies.rb:228:in `require'
from /Users/michaeldunnegan/.rvm/gems/ruby-2.0.0-p247/gems/activesupport-4.0.0/lib/active_support/dependencies.rb:228:in `block in require'
from /Users/michaeldunnegan/.rvm/gems/ruby-2.0.0-p247/gems/activesupport-4.0.0/lib/active_support/dependencies.rb:213:in `load_dependency'
from /Users/michaeldunnegan/.rvm/gems/ruby-2.0.0-p247/gems/activesupport-4.0.0/lib/active_support/dependencies.rb:228:in `require'
from /Users/michaeldunnegan/.rvm/gems/ruby-2.0.0-p247/gems/railties-4.0.0/lib/rails/application.rb:189:in `require_environment!'
from /Users/michaeldunnegan/.rvm/gems/ruby-2.0.0-p247/gems/railties-4.0.0/lib/rails/commands.rb:45:in `<top (required)>'
from bin/rails:4:in `require'
from bin/rails:4:in `<main>'
One of these lines, /Users/michaeldunnegan/projects/SoundShare/config/environment.rb:4:in'`
is interesting. All I have in that file is:
# Load the Rails application.
require File.expand_path('../application', __FILE__)
SoundShare::Application.initialize! # this is the line
make sure you have the devise gem compatible with rails 4 gem 'devise', '~> 3.0.0.rc' #or higher
run bundle update
Remove devise.rb in initializers, then run devise:install again to install new configs in intializers.
make sure you run devise model generator, for example rails g devise User
now you should be able to run: rails g devise:views
Edit
After working in teamviewer on Mike's computer, we took a copy of devise.rb from a working project on rails 4 and place it in config/initializers/
Next we ran the rails generate devise:install command and it said something back about a deprecation and asked us if we want to replace the content of devise.rb file. We accepted it and after this all devise commands worked well.
Hey I am new to rails and I am getting this error whenever I try to run
rails generate devise User
I get this error in there terminal:
/usr/local/rvm/gems/ruby-1.9.3-p392/gems/railties-4.0.0.rc2/lib/rails/application/routes_reloader.rb:10:in `rescue in execute_if_updated': Rails::Application::RoutesReloader#execute_if_updated delegated to updater.execute_if_updated, but updater is nil: #<Rails::Application::RoutesReloader:0x007fcad64c5e20 #paths=["/Users/DavidStevenson/Desktop/omrails/omrails/config/routes.rb"], #route_sets=[#<ActionDispatch::Routing::RouteSet:0x007fcad64c5d80>]> (RuntimeError)
from /usr/local/rvm/gems/ruby-1.9.3-p392/gems/railties-4.0.0.rc2/lib/rails/application/routes_reloader.rb:6:in `execute_if_updated'
from /usr/local/rvm/gems/ruby-1.9.3-p392/gems/railties-4.0.0.rc2/lib/rails/application/finisher.rb:69:in `block in <module:Finisher>'
from /usr/local/rvm/gems/ruby-1.9.3-p392/gems/railties-4.0.0.rc2/lib/rails/initializable.rb:30:in `instance_exec'
from /usr/local/rvm/gems/ruby-1.9.3-p392/gems/railties-4.0.0.rc2/lib/rails/initializable.rb:30:in `run'
from /usr/local/rvm/gems/ruby-1.9.3-p392/gems/railties-4.0.0.rc2/lib/rails/initializable.rb:55:in `block in run_initializers'
from /usr/local/rvm/rubies/ruby-1.9.3-p392/lib/ruby/1.9.1/tsort.rb:150:in `block in tsort_each'
from /usr/local/rvm/rubies/ruby-1.9.3-p392/lib/ruby/1.9.1/tsort.rb:183:in `block (2 levels) in each_strongly_connected_component'
from /usr/local/rvm/rubies/ruby-1.9.3-p392/lib/ruby/1.9.1/tsort.rb:219:in `each_strongly_connected_component_from'
from /usr/local/rvm/rubies/ruby-1.9.3-p392/lib/ruby/1.9.1/tsort.rb:182:in `block in each_strongly_connected_component'
from /usr/local/rvm/rubies/ruby-1.9.3-p392/lib/ruby/1.9.1/tsort.rb:180:in `each'
from /usr/local/rvm/rubies/ruby-1.9.3-p392/lib/ruby/1.9.1/tsort.rb:180:in `each_strongly_connected_component'
from /usr/local/rvm/rubies/ruby-1.9.3-p392/lib/ruby/1.9.1/tsort.rb:148:in `tsort_each'
from /usr/local/rvm/gems/ruby-1.9.3-p392/gems/railties-4.0.0.rc2/lib/rails/initializable.rb:54:in `run_initializers'
from /usr/local/rvm/gems/ruby-1.9.3-p392/gems/railties-4.0.0.rc2/lib/rails/application.rb:215:in `initialize!'
from /usr/local/rvm/gems/ruby-1.9.3-p392/gems/railties-4.0.0.rc2/lib/rails/railtie/configurable.rb:30:in `method_missing'
from /Users/DavidStevenson/Desktop/omrails/omrails/config/environment.rb:5:in `<top (required)>'
from /usr/local/rvm/gems/ruby-1.9.3-p392/gems/activesupport-4.0.0.rc2/lib/active_support/dependencies.rb:228:in `require'
from /usr/local/rvm/gems/ruby-1.9.3-p392/gems/activesupport-4.0.0.rc2/lib/active_support/dependencies.rb:228:in `block in require'
from /usr/local/rvm/gems/ruby-1.9.3-p392/gems/activesupport-4.0.0.rc2/lib/active_support/dependencies.rb:213:in `load_dependency'
from /usr/local/rvm/gems/ruby-1.9.3-p392/gems/activesupport-4.0.0.rc2/lib/active_support/dependencies.rb:228:in `require'
from /usr/local/rvm/gems/ruby-1.9.3-p392/gems/railties-4.0.0.rc2/lib/rails/application.rb:189:in `require_environment!'
from /usr/local/rvm/gems/ruby-1.9.3-p392/gems/railties-4.0.0.rc2/lib/rails/commands.rb:47:in `<top (required)>'
from bin/rails:4:in `require'
from bin/rails:4:in `<main>'
I have looked in the routes.rb file and could not see anything apparently wrong. When I comment out the line:
devise_for :installs
I can run the server again. Any thoughts why this would happen?
Firstly, why do you use ruby 1.9.3 instead of 2.0 ?
Secondly, why do you use rails 4.0.0.rc2 instead of its stable release 4.0 ?
For your question,
devise requires devise_for :users in your routes.rb file. It must be same as your resource name. Use user both in routes.rb and at your generator.
I found this error after migrating from Active Record to MongoID, the problem is that the Devise initializer (config/initializers/devise.rb) specifies the ORM (line 25 for me):
require 'devise/orm/active_record'
I just only needed to replace this line with:
require 'devise/orm/mongoid'
Now is working :)
I just started learning how to program, but have been using Ubuntu for some years now, so I am well familiar with researching problems and errors, but either this area is too new for me, or I really cant find any specific answers for this.
I am taking a ruby on rails introduction course, and got to the point where I had to install the devise gem and here is where I made a mistake.
While following the instructions on the devise github page I accidentally typed in:
rails generate devise install
instead of
rails generate devise:install
Now, whenever I try to load
rails s
I get this error message:
/home/amer/.rvm/gems/ruby-1.9.3-p327/gems/activesupport-3.2.9/lib/active_support/inflector/methods.rb:230:in `block in constantize': uninitialized constant Install (NameError)
from /home/amer/.rvm/gems/ruby-1.9.3-p327/gems/activesupport-3.2.9/lib/active_support/inflector/methods.rb:229:in `each'
from /home/amer/.rvm/gems/ruby-1.9.3-p327/gems/activesupport-3.2.9/lib/active_support/inflector/methods.rb:229:in `constantize'
from /home/amer/.rvm/gems/ruby-1.9.3-p327/gems/devise-2.1.2/lib/devise.rb:256:in `get'
from /home/amer/.rvm/gems/ruby-1.9.3-p327/gems/devise-2.1.2/lib/devise/mapping.rb:77:in `to'
from /home/amer/.rvm/gems/ruby-1.9.3-p327/gems/devise-2.1.2/lib/devise/mapping.rb:72:in `modules'
from /home/amer/.rvm/gems/ruby-1.9.3-p327/gems/devise-2.1.2/lib/devise/mapping.rb:89:in `routes'
from /home/amer/.rvm/gems/ruby-1.9.3-p327/gems/devise-2.1.2/lib/devise/mapping.rb:156:in `default_used_route'
from /home/amer/.rvm/gems/ruby-1.9.3-p327/gems/devise-2.1.2/lib/devise/mapping.rb:66:in `initialize'
from /home/amer/.rvm/gems/ruby-1.9.3-p327/gems/devise-2.1.2/lib/devise.rb:290:in `new'
from /home/amer/.rvm/gems/ruby-1.9.3-p327/gems/devise-2.1.2/lib/devise.rb:290:in `add_mapping'
from /home/amer/.rvm/gems/ruby-1.9.3-p327/gems/devise-2.1.2/lib/devise/rails/routes.rb:208:in `block in devise_for'
from /home/amer/.rvm/gems/ruby-1.9.3-p327/gems/devise-2.1.2/lib/devise/rails/routes.rb:207:in `each'
from /home/amer/.rvm/gems/ruby-1.9.3-p327/gems/devise-2.1.2/lib/devise/rails/routes.rb:207:in `devise_for'
from /home/amer/Documents/Rails_Projects/omrails/omrails1/config/routes.rb:3:in `block in <top (required)>'
from /home/amer/.rvm/gems/ruby-1.9.3-p327/gems/actionpack-3.2.9/lib/action_dispatch/routing/route_set.rb:282:in `instance_exec'
from /home/amer/.rvm/gems/ruby-1.9.3-p327/gems/actionpack-3.2.9/lib/action_dispatch/routing/route_set.rb:282:in `eval_block'
from /home/amer/.rvm/gems/ruby-1.9.3-p327/gems/actionpack-3.2.9/lib/action_dispatch/routing/route_set.rb:260:in `draw'
from /home/amer/Documents/Rails_Projects/omrails/omrails1/config/routes.rb:1:in `<top (required)>'
from /home/amer/.rvm/gems/ruby-1.9.3-p327/gems/railties-3.2.9/lib/rails/application/routes_reloader.rb:40:in `block in load_paths'
from /home/amer/.rvm/gems/ruby-1.9.3-p327/gems/railties-3.2.9/lib/rails/application/routes_reloader.rb:40:in `each'
from /home/amer/.rvm/gems/ruby-1.9.3-p327/gems/railties-3.2.9/lib/rails/application/routes_reloader.rb:40:in `load_paths'
from /home/amer/.rvm/gems/ruby-1.9.3-p327/gems/railties-3.2.9/lib/rails/application/routes_reloader.rb:16:in `reload!'
from /home/amer/.rvm/gems/ruby-1.9.3-p327/gems/railties-3.2.9/lib/rails/application/routes_reloader.rb:26:in `block in updater'
from /home/amer/.rvm/gems/ruby-1.9.3-p327/gems/activesupport-3.2.9/lib/active_support/file_update_checker.rb:78:in `call'
from /home/amer/.rvm/gems/ruby-1.9.3-p327/gems/activesupport-3.2.9/lib/active_support/file_update_checker.rb:78:in `execute'
from /home/amer/.rvm/gems/ruby-1.9.3-p327/gems/railties-3.2.9/lib/rails/application/routes_reloader.rb:27:in `updater'
from /home/amer/.rvm/gems/ruby-1.9.3-p327/gems/railties-3.2.9/lib/rails/application/routes_reloader.rb:7:in `execute_if_updated'
from /home/amer/.rvm/gems/ruby-1.9.3-p327/gems/railties-3.2.9/lib/rails/application/finisher.rb:66:in `block in <module:Finisher>'
from /home/amer/.rvm/gems/ruby-1.9.3-p327/gems/railties-3.2.9/lib/rails/initializable.rb:30:in `instance_exec'
from /home/amer/.rvm/gems/ruby-1.9.3-p327/gems/railties-3.2.9/lib/rails/initializable.rb:30:in `run'
from /home/amer/.rvm/gems/ruby-1.9.3-p327/gems/railties-3.2.9/lib/rails/initializable.rb:55:in `block in run_initializers'
from /home/amer/.rvm/gems/ruby-1.9.3-p327/gems/railties-3.2.9/lib/rails/initializable.rb:54:in `each'
from /home/amer/.rvm/gems/ruby-1.9.3-p327/gems/railties-3.2.9/lib/rails/initializable.rb:54:in `run_initializers'
from /home/amer/.rvm/gems/ruby-1.9.3-p327/gems/railties-3.2.9/lib/rails/application.rb:136:in `initialize!'
from /home/amer/.rvm/gems/ruby-1.9.3-p327/gems/railties-3.2.9/lib/rails/railtie/configurable.rb:30:in `method_missing'
from /home/amer/Documents/Rails_Projects/omrails/omrails1/config/environment.rb:5:in `<top (required)>'
from /home/amer/Documents/Rails_Projects/omrails/omrails1/config.ru:4:in `block in <main>'
from /home/amer/.rvm/gems/ruby-1.9.3-p327/gems/rack-1.4.1/lib/rack/builder.rb:51:in `instance_eval'
from /home/amer/.rvm/gems/ruby-1.9.3-p327/gems/rack-1.4.1/lib/rack/builder.rb:51:in `initialize'
from /home/amer/Documents/Rails_Projects/omrails/omrails1/config.ru:1:in `new'
from /home/amer/Documents/Rails_Projects/omrails/omrails1/config.ru:1:in `<main>'
from /home/amer/.rvm/gems/ruby-1.9.3-p327/gems/rack-1.4.1/lib/rack/builder.rb:40:in `eval'
from /home/amer/.rvm/gems/ruby-1.9.3-p327/gems/rack-1.4.1/lib/rack/builder.rb:40:in `parse_file'
from /home/amer/.rvm/gems/ruby-1.9.3-p327/gems/rack-1.4.1/lib/rack/server.rb:200:in `app'
from /home/amer/.rvm/gems/ruby-1.9.3-p327/gems/railties-3.2.9/lib/rails/commands/server.rb:46:in `app'
from /home/amer/.rvm/gems/ruby-1.9.3-p327/gems/rack-1.4.1/lib/rack/server.rb:301:in `wrapped_app'
from /home/amer/.rvm/gems/ruby-1.9.3-p327/gems/rack-1.4.1/lib/rack/server.rb:252:in `start'
from /home/amer/.rvm/gems/ruby-1.9.3-p327/gems/railties-3.2.9/lib/rails/commands/server.rb:70:in `start'
from /home/amer/.rvm/gems/ruby-1.9.3-p327/gems/railties-3.2.9/lib/rails/commands.rb:55:in `block in <top (required)>'
from /home/amer/.rvm/gems/ruby-1.9.3-p327/gems/railties-3.2.9/lib/rails/commands.rb:50:in `tap'
from /home/amer/.rvm/gems/ruby-1.9.3-p327/gems/railties-3.2.9/lib/rails/commands.rb:50:in `<top (required)>'
from script/rails:6:in `require'
from script/rails:6:in `<main>'
Before posting here I tried reinstalling ruby 1.9.3. using rvm. I tried using
rvm gemset empty [gemset_name]
as was discribed in RVM: Uninstalling all gems of a gemset but that didn't really help either.
What should I do? Can anyone explain to me what is happening here?
I understood your problem.
You have written rails generate devise install. It means that you have associated install as a model to devise rather configure it. So your files have been created with out devise configuration.
You just follow what I have written:
1) Create a devise.rb file in '/config/initializers'
2) Write the following code inside it:
Devise.setup do |config|
config.mailer_sender = "devise#example.com"
config.scoped_views = true
require 'devise/orm/active_record'#[This works for you]
config.case_insensitive_keys = [ :email ]
config.strip_whitespace_keys = [ :email ]
config.skip_session_storage = [:http_auth]
config.stretches = Rails.env.test? ? 1 : 10
config.reconfirmable = true
config.reset_password_within = 6.hours
config.sign_out_via = :delete
end
2) And write rails destroy devise install in the terminal. Thats it.
I think the above will work for sure.
3) Now start your server again rails s.
4) Install devise again carefully. And go ahead.
I don't think you have a gem problem, just a confused Devise setup, which is likely easily unconfused.
When you run the Devise generator (with rails generate Devise:something) it runs code to create a few files specific to your application within your application tree (app/*). I am looking at a Devise install and think it's mostly going to be in the app/views/devise directory, but it's possible that it also updates your User model. It definitely updates your app/routes.rb file and creates a file in config/initializers. There may be others.
Delete any of these. There may be other files in locales, db/migrate (there is a migration -- don't run it, or run rake db:rollback before deleting it if you have).
Then re-run the installation.
Another approach if this doesn't work would be to create a new dummy Rails app, install devise there, and see what files get created -- usually generators report what they are doing.