Error when execute rails generate scaffold User name:string email:string - ruby-on-rails

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'

Related

no migration via terminal

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.

How do I create or update a model based on one of its attributes? (Rails 5)

I’m using Rails 5 and PostGres 9.5 . I have a model with the following field …
title | character varying |
I would like to either create or update a model in my db/seeds file based on its title, which is a unique constraint. So I tried
scenario = Scenario.find_or_initialize_by_title(s.title)
scenario.update_attributes(Hash[*#record.attributes.except('created_at','updated_at','id').map { |a| [a.first, nil] }.flatten])
but I got the below error. What’s the correct way to create or update my model and also exclude the listed attributes?
localhost:sims nataliab$ rake db:seed
rake aborted!
NoMethodError: undefined method `find_or_initialize_by_title' for #<Class:0x007fb22d28f820>
Did you mean? find_or_initialize_by
/Users/nataliab/.rvm/gems/ruby-2.3.0/gems/activerecord-5.0.0.1/lib/active_record/dynamic_matchers.rb:21:in `method_missing'
/Users/nataliab/Documents/workspace/sims/db/seed/scenarios.rb:165:in `block in <top (required)>'
/Users/nataliab/Documents/workspace/sims/db/seed/scenarios.rb:164:in `each'
/Users/nataliab/Documents/workspace/sims/db/seed/scenarios.rb:164:in `<top (required)>'
/Users/nataliab/.rvm/gems/ruby-2.3.0/gems/activesupport-5.0.0.1/lib/active_support/dependencies.rb:293:in `require'
/Users/nataliab/.rvm/gems/ruby-2.3.0/gems/activesupport-5.0.0.1/lib/active_support/dependencies.rb:293:in `block in require'
/Users/nataliab/.rvm/gems/ruby-2.3.0/gems/activesupport-5.0.0.1/lib/active_support/dependencies.rb:259:in `load_dependency'
/Users/nataliab/.rvm/gems/ruby-2.3.0/gems/activesupport-5.0.0.1/lib/active_support/dependencies.rb:293:in `require'
/Users/nataliab/Documents/workspace/sims/db/seeds.rb:10:in `<top (required)>'
/Users/nataliab/.rvm/gems/ruby-2.3.0/gems/activesupport-5.0.0.1/lib/active_support/dependencies.rb:287:in `load'
/Users/nataliab/.rvm/gems/ruby-2.3.0/gems/activesupport-5.0.0.1/lib/active_support/dependencies.rb:287:in `block in load'
/Users/nataliab/.rvm/gems/ruby-2.3.0/gems/activesupport-5.0.0.1/lib/active_support/dependencies.rb:259:in `load_dependency'
/Users/nataliab/.rvm/gems/ruby-2.3.0/gems/activesupport-5.0.0.1/lib/active_support/dependencies.rb:287:in `load'
/Users/nataliab/.rvm/gems/ruby-2.3.0/gems/railties-5.0.0.1/lib/rails/engine.rb:549:in `load_seed'
/Users/nataliab/.rvm/gems/ruby-2.3.0/gems/activerecord-5.0.0.1/lib/active_record/tasks/database_tasks.rb:268:in `load_seed'
/Users/nataliab/.rvm/gems/ruby-2.3.0/gems/activerecord-5.0.0.1/lib/active_record/railties/databases.rake:196:in `block (2 levels) in <top (required)>'
/Users/nataliab/.rvm/gems/ruby-2.3.0/gems/rake-11.3.0/exe/rake:27:in `<top (required)>'
/Users/nataliab/.rvm/gems/ruby-2.3.0/bin/ruby_executable_hooks:15:in `eval'
/Users/nataliab/.rvm/gems/ruby-2.3.0/bin/ruby_executable_hooks:15:in `<main>'
Tasks: TOP => db:seed
(See full trace by running task with --trace)
The error message gives you the clue:
NoMethodError: undefined method `find_or_initialize_by_title' for #<Class:0x007fb22d28f820>
Did you mean? find_or_initialize_by
The dynamic method names are now not really "Rails-approved" you should instead use find_or_initialize_by. In this case you'd use:
Scenario.find_or_initialize_by(title: s.title)
Here's a link to the api doc on this method: http://apidock.com/rails/v4.0.2/ActiveRecord/Relation/find_or_initialize_by
Try Scenario.find_or_initialize_by(title: s.title)

There was an error while trying to load the gem 'rails-api'. (Bundler::GemRequireError)

I am working with Rails 5.0.0.beta3 and creating a rails-api. when i run
rails-api generate scaffold user email:string password:string auth_token:string
it shows the error
.rvm/gems/ruby-2.2.3/gems/bundler-1.11.2/lib/bundler/runtime.rb:80:in `rescue in block (2 levels) in require': There was an error while trying to load the gem 'rails-api'. (Bundler::GemRequireError)
from /home/ahsanul/.rvm/gems/ruby-2.2.3/gems/bundler-1.11.2/lib/bundler/runtime.rb:76:in `block (2 levels) in require'
from /home/ahsanul/.rvm/gems/ruby-2.2.3/gems/bundler-1.11.2/lib/bundler/runtime.rb:72:in `each'
from /home/ahsanul/.rvm/gems/ruby-2.2.3/gems/bundler-1.11.2/lib/bundler/runtime.rb:72:in `block in require'
from /home/ahsanul/.rvm/gems/ruby-2.2.3/gems/bundler-1.11.2/lib/bundler/runtime.rb:61:in `each'
from /home/ahsanul/.rvm/gems/ruby-2.2.3/gems/bundler-1.11.2/lib/bundler/runtime.rb:61:in `require'
from /home/ahsanul/.rvm/gems/ruby-2.2.3/gems/bundler-1.11.2/lib/bundler.rb:99:in `require'
from /home/ahsanul/Documents/rails-api/my_blog/config/application.rb:7:in `<top (required)>'
from /home/ahsanul/.rvm/gems/ruby-2.2.3/gems/spring-1.7.1/lib/spring/application.rb:82:in `require'
from /home/ahsanul/.rvm/gems/ruby-2.2.3/gems/spring-1.7.1/lib/spring/application.rb:82:in `preload'
from /home/ahsanul/.rvm/gems/ruby-2.2.3/gems/spring-1.7.1/lib/spring/application.rb:143:in `serve'
from /home/ahsanul/.rvm/gems/ruby-2.2.3/gems/spring-1.7.1/lib/spring/application.rb:131:in `block in run'
from /home/ahsanul/.rvm/gems/ruby-2.2.3/gems/spring-1.7.1/lib/spring/application.rb:125:in `loop'
from /home/ahsanul/.rvm/gems/ruby-2.2.3/gems/spring-1.7.1/lib/spring/application.rb:125:in `run'
from /home/ahsanul/.rvm/gems/ruby-2.2.3/gems/spring-1.7.1/lib/spring/application/boot.rb:19:in `<top (required)>'
from /home/ahsanul/.rvm/rubies/ruby-2.2.3/lib/ruby/site_ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in `require'
from /home/ahsanul/.rvm/rubies/ruby-2.2.3/lib/ruby/site_ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in `require'
from -e:1:in `<main>'
How can i resolve the problem?
You don't need to include rails-api gem in your Rails 5 app's Gemfile. It's already merged into Rails 5.
Reference
I tried all the above suggestion from Babar but didn't work, so i tried one little thing that work which is adding gem 'listen' to the gem file.
it works for me!!
rails-api generate scaffold user email:string password:string auth_token:string
No need of writing rails-api, just use rails. Rails::API has been merged into Rails 5.0, so no need of gem 'rails-api'.So remove it from gemfile.After than you may get error when you try to migrate.So you have to include listen gem.

"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.

Resources