Error running rails generate devise User - ruby-on-rails

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 :)

Related

Rails s error: `method_missing': undefined method `active_record'

My rails project works before. I got this error because I deleted mysql and everything associated mysql.
Then I reinstalled mysql. It got this error. Then I reinstalled ruby and rails. The error is still here. Using "rails new myapp",
then "bundle instal",
then "rails s",
I got the following error:
=> Booting WEBrick
=> Rails 4.0.2 application starting in development on
=> Run `rails server -h` for more startup options
=> Ctrl-C to shutdown server
Exiting
**/home/cwu/.rvm/gems/ruby-2.1.0/gems/railties-4.0.2/lib/rails/railtie/configuration.rb:95:in `method_missing': undefined method `active_record' for #<Rails::Application::Configuration:0x0000000303cae8> (NoMethodError)
from /home/cwu/Dropbox/project/web/atop/config/environments/development.rb:23:in `block in <top (required)>'**
from /home/cwu/.rvm/gems/ruby-2.1.0/gems/railties-4.0.2/lib/rails/railtie/configurable.rb:24:in `class_eval'
from /home/cwu/.rvm/gems/ruby-2.1.0/gems/railties-4.0.2/lib/rails/railtie/configurable.rb:24:in `configure'
from /home/cwu/Dropbox/project/web/atop/config/environments/development.rb:1:in `<top (required)>'
from /home/cwu/.rvm/gems/ruby-2.1.0/gems/activesupport-4.0.2/lib/active_support/dependencies.rb:229:in `require'
from /home/cwu/.rvm/gems/ruby-2.1.0/gems/activesupport-4.0.2/lib/active_support/dependencies.rb:229:in `block in require'
from /home/cwu/.rvm/gems/ruby-2.1.0/gems/activesupport-4.0.2/lib/active_support/dependencies.rb:214:in `load_dependency'
from /home/cwu/.rvm/gems/ruby-2.1.0/gems/activesupport-4.0.2/lib/active_support/dependencies.rb:229:in `require'
from /home/cwu/.rvm/gems/ruby-2.1.0/gems/railties-4.0.2/lib/rails/engine.rb:591:in `block (2 levels) in <class:Engine>'
from /home/cwu/.rvm/gems/ruby-2.1.0/gems/railties-4.0.2/lib/rails/engine.rb:590:in `each'
from /home/cwu/.rvm/gems/ruby-2.1.0/gems/railties-4.0.2/lib/rails/engine.rb:590:in `block in <class:Engine>'
from /home/cwu/.rvm/gems/ruby-2.1.0/gems/railties-4.0.2/lib/rails/initializable.rb:30:in `instance_exec'
from /home/cwu/.rvm/gems/ruby-2.1.0/gems/railties-4.0.2/lib/rails/initializable.rb:30:in `run'
from /home/cwu/.rvm/gems/ruby-2.1.0/gems/railties-4.0.2/lib/rails/initializable.rb:55:in `block in run_initializers'
from /home/cwu/.rvm/rubies/ruby-2.1.0/lib/ruby/2.1.0/tsort.rb:226:in `block in tsort_each'
from /home/cwu/.rvm/rubies/ruby-2.1.0/lib/ruby/2.1.0/tsort.rb:348:in `block (2 levels) in each_strongly_connected_component'
from /home/cwu/.rvm/rubies/ruby-2.1.0/lib/ruby/2.1.0/tsort.rb:418:in `block (2 levels) in each_strongly_connected_component_from'
from /home/cwu/.rvm/rubies/ruby-2.1.0/lib/ruby/2.1.0/tsort.rb:427:in `each_strongly_connected_component_from'
from /home/cwu/.rvm/rubies/ruby-2.1.0/lib/ruby/2.1.0/tsort.rb:417:in `block in each_strongly_connected_component_from'
from /home/cwu/.rvm/gems/ruby-2.1.0/gems/railties-4.0.2/lib/rails/initializable.rb:44:in `each'
from /home/cwu/.rvm/gems/ruby-2.1.0/gems/railties-4.0.2/lib/rails/initializable.rb:44:in `tsort_each_child'
from /home/cwu/.rvm/rubies/ruby-2.1.0/lib/ruby/2.1.0/tsort.rb:411:in `call'
from /home/cwu/.rvm/rubies/ruby-2.1.0/lib/ruby/2.1.0/tsort.rb:411:in `each_strongly_connected_component_from'
from /home/cwu/.rvm/rubies/ruby-2.1.0/lib/ruby/2.1.0/tsort.rb:347:in `block in each_strongly_connected_component'
from /home/cwu/.rvm/rubies/ruby-2.1.0/lib/ruby/2.1.0/tsort.rb:345:in `each'
from /home/cwu/.rvm/rubies/ruby-2.1.0/lib/ruby/2.1.0/tsort.rb:345:in `call'
from /home/cwu/.rvm/rubies/ruby-2.1.0/lib/ruby/2.1.0/tsort.rb:345:in `each_strongly_connected_component'
from /home/cwu/.rvm/rubies/ruby-2.1.0/lib/ruby/2.1.0/tsort.rb:224:in `tsort_each'
from /home/cwu/.rvm/rubies/ruby-2.1.0/lib/ruby/2.1.0/tsort.rb:205:in `tsort_each'
from /home/cwu/.rvm/gems/ruby-2.1.0/gems/railties-4.0.2/lib/rails/initializable.rb:54:in `run_initializers'
from /home/cwu/.rvm/gems/ruby-2.1.0/gems/railties-4.0.2/lib/rails/application.rb:215:in `initialize!'
from /home/cwu/.rvm/gems/ruby-2.1.0/gems/railties-4.0.2/lib/rails/railtie/configurable.rb:30:in `method_missing'
from /home/cwu/Dropbox/project/web/atop/config/environment.rb:5:in `<top (required)>'
from /home/cwu/Dropbox/project/web/atop/config.ru:3:in `require'
from /home/cwu/Dropbox/project/web/atop/config.ru:3:in `block in <main>'
from /home/cwu/.rvm/gems/ruby-2.1.0/gems/rack-1.5.2/lib/rack/builder.rb:55:in `instance_eval'
from /home/cwu/.rvm/gems/ruby-2.1.0/gems/rack-1.5.2/lib/rack/builder.rb:55:in `initialize'
from /home/cwu/Dropbox/project/web/atop/config.ru:in `new'
from /home/cwu/Dropbox/project/web/atop/config.ru:in `<main>'
from /home/cwu/.rvm/gems/ruby-2.1.0/gems/rack-1.5.2/lib/rack/builder.rb:49:in `eval'
from /home/cwu/.rvm/gems/ruby-2.1.0/gems/rack-1.5.2/lib/rack/builder.rb:49:in `new_from_string'
from /home/cwu/.rvm/gems/ruby-2.1.0/gems/rack-1.5.2/lib/rack/builder.rb:40:in `parse_file'
from /home/cwu/.rvm/gems/ruby-2.1.0/gems/rack-1.5.2/lib/rack/server.rb:277:in `build_app_and_options_from_config'
from /home/cwu/.rvm/gems/ruby-2.1.0/gems/rack-1.5.2/lib/rack/server.rb:199:in `app'
from /home/cwu/.rvm/gems/ruby-2.1.0/gems/railties-4.0.2/lib/rails/commands/server.rb:48:in `app'
from /home/cwu/.rvm/gems/ruby-2.1.0/gems/rack-1.5.2/lib/rack/server.rb:314:in `wrapped_app'
from /home/cwu/.rvm/gems/ruby-2.1.0/gems/railties-4.0.2/lib/rails/commands/server.rb:75:in `start'
from /home/cwu/.rvm/gems/ruby-2.1.0/gems/railties-4.0.2/lib/rails/commands.rb:76:in `block in <top (required)>'
from /home/cwu/.rvm/gems/ruby-2.1.0/gems/railties-4.0.2/lib/rails/commands.rb:71:in `tap'
from /home/cwu/.rvm/gems/ruby-2.1.0/gems/railties-4.0.2/lib/rails/commands.rb:71:in `<top (required)>'
from bin/rails:4:in `require'
from bin/rails:4:in `<main>'
The error is clear that in config/environments/development.rb:23 you configure active_record which is not loaded.
Just remove
config.active_record.migration_error = :page_load
Will be ok.
Leedy Liu is right to some degree, but if you're getting this error when you create a new Rails app, t suggests a deeper problem with your environment
According to this answer, you may have require "active_record/railtie" commented out in your application.rb file. Please check to make sure this is not the case
You may have to re-install Rails with ActiveRecord to ensure the functionality is restored with your app. Have you tried this:
gem install bundler
gem install rails
bundle install
Other than that, you need to ensure Ruby on Rails is installed correctly. What env are you running? Linux or Windows?
As a general fix, remove all references to active_record. Easiest way is to do a find on the root directory of "active_records", find all usages, and remove them. I found usages in config/application.rb and config/environments/development and production.rb.
Try:
'gem install bundler'
then:
'bundle install'
again.
See if it clears up.
Comment config.active_record.raise_in_transactional_callbacks = true in config/application.rb and config.active_record.migration_error = :page_load in config/environments/development.rb.

what does this error on devise initialation means [duplicate]

This question already has answers here:
Devise Secret Key was not set
(16 answers)
Closed 8 years ago.
I'm trying to install the devise gem and when I do the
$ rails generate devise: install
I get the following error:
/usr/local/rvm/gems/ruby-2.0.0-p353/gems/devise-3.1.2/lib/devise/rails/routes.rb:440:in `raise_no_secret_key': Devise.secret_key was not set. Please add the following to your Devise initializer: (RuntimeError)
config.secret_key = '964705f2d08f9196c511948baa14a1ef2ba7693b6eb326f9b177a1377d2c8487aab5736798e4bae6286eb0e36298eac3bceff31be5c357d356db8a22edd04a4d'
Please ensure you restarted your application after installing Devise or setting the key.
from /usr/local/rvm/gems/ruby-2.0.0-p353/gems/devise-3.1.2/lib/devise/rails/routes.rb:195:in `devise_for'
from /Users/Katy/Desktop/pinteresting/config/routes.rb:2:in `block in <top (required)>'
from /usr/local/rvm/gems/ruby-2.0.0-p353#global/gems/actionpack-4.0.2/lib/action_dispatch/routing/route_set.rb:341:in `instance_exec'
from /usr/local/rvm/gems/ruby-2.0.0-p353#global/gems/actionpack-4.0.2/lib/action_dispatch/routing/route_set.rb:341:in `eval_block'
from /usr/local/rvm/gems/ruby-2.0.0-p353#global/gems/actionpack-4.0.2/lib/action_dispatch/routing/route_set.rb:319:in `draw'
from /Users/Katy/Desktop/pinteresting/config/routes.rb:1:in `<top (required)>'
from /usr/local/rvm/gems/ruby-2.0.0-p353#global/gems/activesupport-4.0.2/lib/active_support/dependencies.rb:223:in `load'
from /usr/local/rvm/gems/ruby-2.0.0-p353#global/gems/activesupport-4.0.2/lib/active_support/dependencies.rb:223:in `block in load'
from /usr/local/rvm/gems/ruby-2.0.0-p353#global/gems/activesupport-4.0.2/lib/active_support/dependencies.rb:214:in `load_dependency'
from /usr/local/rvm/gems/ruby-2.0.0-p353#global/gems/activesupport-4.0.2/lib/active_support/dependencies.rb:223:in `load'
from /usr/local/rvm/gems/ruby-2.0.0-p353#global/gems/railties-4.0.2/lib/rails/application/routes_reloader.rb:40:in `block in load_paths'
from /usr/local/rvm/gems/ruby-2.0.0-p353#global/gems/railties-4.0.2/lib/rails/application/routes_reloader.rb:40:in `each'
from /usr/local/rvm/gems/ruby-2.0.0-p353#global/gems/railties-4.0.2/lib/rails/application/routes_reloader.rb:40:in `load_paths'
from /usr/local/rvm/gems/ruby-2.0.0-p353#global/gems/railties-4.0.2/lib/rails/application/routes_reloader.rb:16:in `reload!'
from /usr/local/rvm/gems/ruby-2.0.0-p353#global/gems/railties-4.0.2/lib/rails/application/routes_reloader.rb:26:in `block in updater'
from /usr/local/rvm/gems/ruby-2.0.0-p353#global/gems/activesupport-4.0.2/lib/active_support/file_update_checker.rb:75:in `call'
from /usr/local/rvm/gems/ruby-2.0.0-p353#global/gems/activesupport-4.0.2/lib/active_support/file_update_checker.rb:75:in `execute'
from /usr/local/rvm/gems/ruby-2.0.0-p353#global/gems/railties-4.0.2/lib/rails/application/routes_reloader.rb:27:in `updater'
from /usr/local/rvm/gems/ruby-2.0.0-p353#global/gems/railties-4.0.2/lib/rails/application/routes_reloader.rb:6:in `execute_if_updated'
from /usr/local/rvm/gems/ruby-2.0.0-p353#global/gems/railties-4.0.2/lib/rails/application/finisher.rb:69:in `block in <module:Finisher>'
from /usr/local/rvm/gems/ruby-2.0.0-p353#global/gems/railties-4.0.2/lib/rails/initializable.rb:30:in `instance_exec'
from /usr/local/rvm/gems/ruby-2.0.0-p353#global/gems/railties-4.0.2/lib/rails/initializable.rb:30:in `run'
from /usr/local/rvm/gems/ruby-2.0.0-p353#global/gems/railties-4.0.2/lib/rails/initializable.rb:55:in `block in run_initializers'
from /usr/local/rvm/rubies/ruby-2.0.0-p353/lib/ruby/2.0.0/tsort.rb:150:in `block in tsort_each'
from /usr/local/rvm/rubies/ruby-2.0.0-p353/lib/ruby/2.0.0/tsort.rb:183:in `block (2 levels) in each_strongly_connected_component'
from /usr/local/rvm/rubies/ruby-2.0.0-p353/lib/ruby/2.0.0/tsort.rb:219:in `each_strongly_connected_component_from'
from /usr/local/rvm/rubies/ruby-2.0.0-p353/lib/ruby/2.0.0/tsort.rb:182:in `block in each_strongly_connected_component'
from /usr/local/rvm/rubies/ruby-2.0.0-p353/lib/ruby/2.0.0/tsort.rb:180:in `each'
from /usr/local/rvm/rubies/ruby-2.0.0-p353/lib/ruby/2.0.0/tsort.rb:180:in `each_strongly_connected_component'
from /usr/local/rvm/rubies/ruby-2.0.0-p353/lib/ruby/2.0.0/tsort.rb:148:in `tsort_each'
from /usr/local/rvm/gems/ruby-2.0.0-p353#global/gems/railties-4.0.2/lib/rails/initializable.rb:54:in `run_initializers'
from /usr/local/rvm/gems/ruby-2.0.0-p353#global/gems/railties-4.0.2/lib/rails/application.rb:215:in `initialize!'
from /usr/local/rvm/gems/ruby-2.0.0-p353#global/gems/railties-4.0.2/lib/rails/railtie/configurable.rb:30:in `method_missing'
from /Users/Katy/Desktop/pinteresting/config/environment.rb:5:in `<top (required)>'
from /usr/local/rvm/gems/ruby-2.0.0-p353#global/gems/activesupport-4.0.2/lib/active_support/dependencies.rb:229:in `require'
from /usr/local/rvm/gems/ruby-2.0.0-p353#global/gems/activesupport-4.0.2/lib/active_support/dependencies.rb:229:in `block in require'
from /usr/local/rvm/gems/ruby-2.0.0-p353#global/gems/activesupport-4.0.2/lib/active_support/dependencies.rb:214:in `load_dependency'
from /usr/local/rvm/gems/ruby-2.0.0-p353#global/gems/activesupport-4.0.2/lib/active_support/dependencies.rb:229:in `require'
from /usr/local/rvm/gems/ruby-2.0.0-p353#global/gems/railties-4.0.2/lib/rails/application.rb:189:in `require_environment!'
from /usr/local/rvm/gems/ruby-2.0.0-p353#global/gems/railties-4.0.2/lib/rails/commands.rb:44:in `<top (required)>'
from bin/rails:4:in `require'
from bin/rails:4:in `<main>'
Any thoughts?
open gem file and add this line gem 'devise'
.........open terminal and type bundle install
now again type in terminal rails generate devise:install
This error is happens because of the new devise version, you probably are upgranding the gem version.
Add this line into your config/initializers/devise.rb file
config.secret_key = '964705f2d08f9196c511948baa14a1ef2ba7693b6eb326f9b177a1377d2c8487aab5736798e4bae6286eb0e36298eac3bceff31be5c357d356db8a22edd04a4d'
Type: Generate another secrect_key insted of this old one
on your ruby console you can do this:
rake secret
Then copy the hash into your initializer
Kudos for #Ashitaka

"rails g devise install" instead of "rails g devise:install" in rails4?

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.

Rails 4 Generate Devise Views

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.

Error with rails g devise:views command

I'm new to rails and can't pinpoint the issue. I was following the RailsCast tutorial #209 about Devise and get an error when I run: rails g devise:views
Here is the error:
/Users/chanel.nalani/.rvm/gems/ruby-1.9.2-p320/gems/actionpack-3.2.5/lib/action_dispatch/routing/mapper.rb:185:in `default_controller_and_action': missing :action (ArgumentError)
from /Users/chanel.nalani/.rvm/gems/ruby-1.9.2-p320/gems/actionpack-3.2.5/lib/action_dispatch/routing/mapper.rb:78:in `normalize_options!'
from /Users/chanel.nalani/.rvm/gems/ruby-1.9.2-p320/gems/actionpack-3.2.5/lib/action_dispatch/routing/mapper.rb:61:in `initialize'
from /Users/chanel.nalani/.rvm/gems/ruby-1.9.2-p320/gems/actionpack-3.2.5/lib/action_dispatch/routing/mapper.rb:1304:in `new'
from /Users/chanel.nalani/.rvm/gems/ruby-1.9.2-p320/gems/actionpack-3.2.5/lib/action_dispatch/routing/mapper.rb:1304:in `add_route'
from /Users/chanel.nalani/.rvm/gems/ruby-1.9.2-p320/gems/actionpack-3.2.5/lib/action_dispatch/routing/mapper.rb:1284:in `decomposed_match'
from /Users/chanel.nalani/.rvm/gems/ruby-1.9.2-p320/gems/actionpack-3.2.5/lib/action_dispatch/routing/mapper.rb:1270:in `block in match'
from /Users/chanel.nalani/.rvm/gems/ruby-1.9.2-p320/gems/actionpack-3.2.5/lib/action_dispatch/routing/mapper.rb:1270:in `each'
from /Users/chanel.nalani/.rvm/gems/ruby-1.9.2-p320/gems/actionpack-3.2.5/lib/action_dispatch/routing/mapper.rb:1270:in `match'
from /Users/chanel.nalani/.rvm/gems/ruby-1.9.2-p320/gems/actionpack-3.2.5/lib/action_dispatch/routing/mapper.rb:260:in `root'
from /Users/chanel.nalani/.rvm/gems/ruby-1.9.2-p320/gems/actionpack-3.2.5/lib/action_dispatch/routing/mapper.rb:1317:in `root'
from /Users/chanel.nalani/svn-work/gwb/trunk/PMOCCU/uidevise/config/routes.rb:8:in `block in <top (required)>'
from /Users/chanel.nalani/.rvm/gems/ruby-1.9.2-p320/gems/actionpack-3.2.5/lib/action_dispatch/routing/route_set.rb:282:in `instance_exec'
from /Users/chanel.nalani/.rvm/gems/ruby-1.9.2-p320/gems/actionpack-3.2.5/lib/action_dispatch/routing/route_set.rb:282:in `eval_block'
from /Users/chanel.nalani/.rvm/gems/ruby-1.9.2-p320/gems/actionpack-3.2.5/lib/action_dispatch/routing/route_set.rb:260:in `draw'
from /Users/chanel.nalani/svn-work/gwb/trunk/PMOCCU/uidevise/config/routes.rb:1:in `<top (required)>'
from /Users/chanel.nalani/.rvm/gems/ruby-1.9.2-p320/gems/activesupport-3.2.5/lib/active_support/dependencies.rb:245:in `load'
from /Users/chanel.nalani/.rvm/gems/ruby-1.9.2-p320/gems/activesupport-3.2.5/lib/active_support/dependencies.rb:245:in `block in load'
from /Users/chanel.nalani/.rvm/gems/ruby-1.9.2-p320/gems/activesupport-3.2.5/lib/active_support/dependencies.rb:236:in `load_dependency'
from /Users/chanel.nalani/.rvm/gems/ruby-1.9.2-p320/gems/activesupport-3.2.5/lib/active_support/dependencies.rb:245:in `load'
from /Users/chanel.nalani/.rvm/gems/ruby-1.9.2-p320/gems/railties-3.2.5/lib/rails/application/routes_reloader.rb:40:in `block in load_paths'
from /Users/chanel.nalani/.rvm/gems/ruby-1.9.2-p320/gems/railties-3.2.5/lib/rails/application/routes_reloader.rb:40:in `each'
from /Users/chanel.nalani/.rvm/gems/ruby-1.9.2-p320/gems/railties-3.2.5/lib/rails/application/routes_reloader.rb:40:in `load_paths'
from /Users/chanel.nalani/.rvm/gems/ruby-1.9.2-p320/gems/railties-3.2.5/lib/rails/application/routes_reloader.rb:16:in `reload!'
from /Users/chanel.nalani/.rvm/gems/ruby-1.9.2-p320/gems/railties-3.2.5/lib/rails/application/routes_reloader.rb:26:in `block in updater'
from /Users/chanel.nalani/.rvm/gems/ruby-1.9.2-p320/gems/activesupport-3.2.5/lib/active_support/file_update_checker.rb:78:in `call'
from /Users/chanel.nalani/.rvm/gems/ruby-1.9.2-p320/gems/activesupport-3.2.5/lib/active_support/file_update_checker.rb:78:in `execute'
from /Users/chanel.nalani/.rvm/gems/ruby-1.9.2-p320/gems/railties-3.2.5/lib/rails/application/routes_reloader.rb:27:in `updater'
from /Users/chanel.nalani/.rvm/gems/ruby-1.9.2-p320/gems/railties-3.2.5/lib/rails/application/routes_reloader.rb:7:in `execute_if_updated'
from /Users/chanel.nalani/.rvm/gems/ruby-1.9.2-p320/gems/railties-3.2.5/lib/rails/application/finisher.rb:66:in `block in <module:Finisher>'
from /Users/chanel.nalani/.rvm/gems/ruby-1.9.2-p320/gems/railties-3.2.5/lib/rails/initializable.rb:30:in `instance_exec'
from /Users/chanel.nalani/.rvm/gems/ruby-1.9.2-p320/gems/railties-3.2.5/lib/rails/initializable.rb:30:in `run'
from /Users/chanel.nalani/.rvm/gems/ruby-1.9.2-p320/gems/railties-3.2.5/lib/rails/initializable.rb:55:in `block in run_initializers'
from /Users/chanel.nalani/.rvm/gems/ruby-1.9.2-p320/gems/railties-3.2.5/lib/rails/initializable.rb:54:in `each'
from /Users/chanel.nalani/.rvm/gems/ruby-1.9.2-p320/gems/railties-3.2.5/lib/rails/initializable.rb:54:in `run_initializers'
from /Users/chanel.nalani/.rvm/gems/ruby-1.9.2-p320/gems/railties-3.2.5/lib/rails/application.rb:136:in `initialize!'
from /Users/chanel.nalani/.rvm/gems/ruby-1.9.2-p320/gems/railties-3.2.5/lib/rails/railtie/configurable.rb:30:in `method_missing'
from /Users/chanel.nalani/svn-work/gwb/trunk/PMOCCU/uidevise/config/environment.rb:5:in `<top (required)>'
from /Users/chanel.nalani/.rvm/gems/ruby-1.9.2-p320/gems/activesupport-3.2.5/lib/active_support/dependencies.rb:251:in `require'
from /Users/chanel.nalani/.rvm/gems/ruby-1.9.2-p320/gems/activesupport-3.2.5/lib/active_support/dependencies.rb:251:in `block in require'
from /Users/chanel.nalani/.rvm/gems/ruby-1.9.2-p320/gems/activesupport-3.2.5/lib/active_support/dependencies.rb:236:in `load_dependency'
from /Users/chanel.nalani/.rvm/gems/ruby-1.9.2-p320/gems/activesupport-3.2.5/lib/active_support/dependencies.rb:251:in `require'
from /Users/chanel.nalani/.rvm/gems/ruby-1.9.2-p320/gems/railties-3.2.5/lib/rails/application.rb:103:in `require_environment!'
from /Users/chanel.nalani/.rvm/gems/ruby-1.9.2-p320/gems/railties-3.2.5/lib/rails/commands.rb:25:in `<top (required)>'
from script/rails:6:in `require'
from script/rails:6:in `<main>'
I changed the version of ruby to see if that would fix the issue but I haven't been able to find the exact problem. Did anybody else run into this error?
Looks like you are missing some manual setup that needs to be done(as #dougui and #janders223 pointed out, it's most likely your route), as printed on the console as soon as you finished running rails generate devise:install :
===============================================================================
Some setup you must do manually if you haven't yet:
1. Ensure you have defined default url options in your environments files. Here
is an example of default_url_options appropriate for a development environment
in config/environments/development.rb:
config.action_mailer.default_url_options = { :host => 'localhost:3000' }
In production, :host should be set to the actual host of your application.
2. Ensure you have defined root_url to *something* in your config/routes.rb.
For example:
root :to => "home#index"
3. Ensure you have flash messages in app/views/layouts/application.html.erb.
For example:
<p class="notice"><%= notice %></p>
<p class="alert"><%= alert %></p>
4. If you are deploying Rails 3.1 on Heroku, you may want to set:
config.assets.initialize_on_precompile = false
On config/application.rb forcing your application to not access the DB
or load models when precompiling your assets.
===============================================================================
Taken from https://github.com/plataformatec/devise/blob/master/lib/generators/templates/README

Resources