Running rake routes on Rails 5 giving instantiation error - ruby-on-rails

I'm trying to setup a barebones Rails app. So far I have generated a sample Article model, added some records to the database, edited my routes config to the following:
Rails::Application.routes.draw do
resources :articles
end
But when I run bin/rake routes, bundle exec rake routes, and just rake routes I receive the following error:
$ bin/rake routes (articles-controllerāœ±)
rake aborted!
Rails::Application is abstract, you cannot instantiate it directly.
/Users/sam/.rvm/gems/ruby-2.2.6/gems/railties-5.1.1/lib/rails/railtie.rb:206:in `initialize'
/Users/sam/.rvm/gems/ruby-2.2.6/gems/railties-5.1.1/lib/rails/engine.rb:434:in `initialize'
/Users/sam/.rvm/gems/ruby-2.2.6/gems/railties-5.1.1/lib/rails/application.rb:124:in `initialize'
/Users/sam/.rvm/gems/ruby-2.2.6/gems/railties-5.1.1/lib/rails/railtie.rb:162:in `new'
/Users/sam/.rvm/gems/ruby-2.2.6/gems/railties-5.1.1/lib/rails/railtie.rb:162:in `instance'
/Users/sam/.rvm/gems/ruby-2.2.6/gems/railties-5.1.1/lib/rails/application.rb:95:in `instance'
/Users/sam/.rvm/gems/ruby-2.2.6/gems/railties-5.1.1/lib/rails/railtie.rb:184:in `method_missing'
/Users/sam/turing/2module/personal_work/projects/blogger/config/routes.rb:1:in `<top (required)>'
/Users/sam/.rvm/gems/ruby-2.2.6/gems/activesupport-5.1.1/lib/active_support/dependencies.rb:286:in `load'
/Users/sam/.rvm/gems/ruby-2.2.6/gems/activesupport-5.1.1/lib/active_support/dependencies.rb:286:in `block in load'
/Users/sam/.rvm/gems/ruby-2.2.6/gems/activesupport-5.1.1/lib/active_support/dependencies.rb:258:in `load_dependency'
/Users/sam/.rvm/gems/ruby-2.2.6/gems/activesupport-5.1.1/lib/active_support/dependencies.rb:286:in `load'
/Users/sam/.rvm/gems/ruby-2.2.6/gems/railties-5.1.1/lib/rails/application/routes_reloader.rb:55:in `block in load_paths'
/Users/sam/.rvm/gems/ruby-2.2.6/gems/railties-5.1.1/lib/rails/application/routes_reloader.rb:55:in `each'
/Users/sam/.rvm/gems/ruby-2.2.6/gems/railties-5.1.1/lib/rails/application/routes_reloader.rb:55:in `load_paths'
/Users/sam/.rvm/gems/ruby-2.2.6/gems/railties-5.1.1/lib/rails/application/routes_reloader.rb:18:in `reload!'
/Users/sam/.rvm/gems/ruby-2.2.6/gems/railties-5.1.1/lib/rails/application/routes_reloader.rb:41:in `block in updater'
/Users/sam/.rvm/gems/ruby-2.2.6/gems/activesupport-5.1.1/lib/active_support/file_update_checker.rb:81:in `call'
/Users/sam/.rvm/gems/ruby-2.2.6/gems/activesupport-5.1.1/lib/active_support/file_update_checker.rb:81:in `execute'
/Users/sam/.rvm/gems/ruby-2.2.6/gems/railties-5.1.1/lib/rails/application/routes_reloader.rb:42:in `updater'
/Users/sam/.rvm/gems/ruby-2.2.6/gems/railties-5.1.1/lib/rails/application/routes_reloader.rb:31:in `execute_if_updated'
/Users/sam/.rvm/gems/ruby-2.2.6/gems/railties-5.1.1/lib/rails/application/finisher.rb:128:in `block in <module:Finisher>'
/Users/sam/.rvm/gems/ruby-2.2.6/gems/railties-5.1.1/lib/rails/initializable.rb:30:in `instance_exec'
/Users/sam/.rvm/gems/ruby-2.2.6/gems/railties-5.1.1/lib/rails/initializable.rb:30:in `run'
/Users/sam/.rvm/gems/ruby-2.2.6/gems/railties-5.1.1/lib/rails/initializable.rb:59:in `block in run_initializers'
/Users/sam/.rvm/gems/ruby-2.2.6/gems/railties-5.1.1/lib/rails/initializable.rb:58:in `run_initializers'
/Users/sam/.rvm/gems/ruby-2.2.6/gems/railties-5.1.1/lib/rails/application.rb:353:in `initialize!'
/Users/sam/turing/2module/personal_work/projects/blogger/config/environment.rb:5:in `<top (required)>'
/Users/sam/.rvm/gems/ruby-2.2.6/gems/railties-5.1.1/lib/rails/application.rb:329:in `require'
/Users/sam/.rvm/gems/ruby-2.2.6/gems/railties-5.1.1/lib/rails/application.rb:329:in `require_environment!'
/Users/sam/.rvm/gems/ruby-2.2.6/gems/railties-5.1.1/lib/rails/application.rb:445:in `block in run_tasks_blocks'
Tasks: TOP => routes => environment
(See full trace by running task with --trace)
Any ideas? All of my gems are up to date using bundle update

Oops, looks like the syntax for the routes.rb file is a bit different in Rails 5. For anyone else with this issue, the syntax for the do block is Rails.application.routes.draw do, not Rails::Application.routes.draw do

Related

Cannot load Rails app fetched from GitHub; rake, rails server not working

I cloned an app folder from a GitHub repository, and after bundle install the gems, I tried to use the rake db:reset and rake db:migrate commands, neither worked, and here is my error message:
>[app_folder]rake db:reset
rake aborted!
Could not load database configuration. No such file - /Users/harry/Dropbox/apps/app_folder/config/database.yml
/usr/local/rvm/gems/ruby-2.0.0-p353#railstutorial_rails_4_0/gems/railties-4.0.0/lib/rails/application/configuration.rb:110:in `database_configuration'
/usr/local/rvm/gems/ruby-2.0.0-p353#railstutorial_rails_4_0/gems/activerecord-4.0.0/lib/active_record/railtie.rb:174:in `block (2 levels) in <class:Railtie>'
/usr/local/rvm/gems/ruby-2.0.0-p353#railstutorial_rails_4_0/gems/activesupport-4.0.0/lib/active_support/lazy_load_hooks.rb:38:in `instance_eval'
/usr/local/rvm/gems/ruby-2.0.0-p353#railstutorial_rails_4_0/gems/activesupport-4.0.0/lib/active_support/lazy_load_hooks.rb:38:in `execute_hook'
/usr/local/rvm/gems/ruby-2.0.0-p353#railstutorial_rails_4_0/gems/activesupport-4.0.0/lib/active_support/lazy_load_hooks.rb:28:in `block in on_load'
/usr/local/rvm/gems/ruby-2.0.0-p353#railstutorial_rails_4_0/gems/activesupport-4.0.0/lib/active_support/lazy_load_hooks.rb:27:in `each'
/usr/local/rvm/gems/ruby-2.0.0-p353#railstutorial_rails_4_0/gems/activesupport-4.0.0/lib/active_support/lazy_load_hooks.rb:27:in `on_load'
/usr/local/rvm/gems/ruby-2.0.0-p353#railstutorial_rails_4_0/gems/activerecord-4.0.0/lib/active_record/railtie.rb:173:in `block in <class:Railtie>'
/usr/local/rvm/gems/ruby-2.0.0-p353#railstutorial_rails_4_0/gems/railties-4.0.0/lib/rails/initializable.rb:30:in `instance_exec'
/usr/local/rvm/gems/ruby-2.0.0-p353#railstutorial_rails_4_0/gems/railties-4.0.0/lib/rails/initializable.rb:30:in `run'
/usr/local/rvm/gems/ruby-2.0.0-p353#railstutorial_rails_4_0/gems/railties-4.0.0/lib/rails/initializable.rb:55:in `block in run_initializers'
/usr/local/rvm/gems/ruby-2.0.0-p353#railstutorial_rails_4_0/gems/railties-4.0.0/lib/rails/initializable.rb:54:in `run_initializers'
/usr/local/rvm/gems/ruby-2.0.0-p353#railstutorial_rails_4_0/gems/railties-4.0.0/lib/rails/application.rb:215:in `initialize!'
/usr/local/rvm/gems/ruby-2.0.0-p353#railstutorial_rails_4_0/gems/railties-4.0.0/lib/rails/railtie/configurable.rb:30:in `method_missing'
/Users/harry/Dropbox/apps/app_folder/config/environment.rb:5:in `<top (required)>'
/usr/local/rvm/gems/ruby-2.0.0-p353#railstutorial_rails_4_0/gems/activesupport-4.0.0/lib/active_support/dependencies.rb:228:in `require'
/usr/local/rvm/gems/ruby-2.0.0-p353#railstutorial_rails_4_0/gems/activesupport-4.0.0/lib/active_support/dependencies.rb:228:in `block in require'
/usr/local/rvm/gems/ruby-2.0.0-p353#railstutorial_rails_4_0/gems/activesupport-4.0.0/lib/active_support/dependencies.rb:213:in `load_dependency'
/usr/local/rvm/gems/ruby-2.0.0-p353#railstutorial_rails_4_0/gems/activesupport-4.0.0/lib/active_support/dependencies.rb:228:in `require'
/usr/local/rvm/gems/ruby-2.0.0-p353#railstutorial_rails_4_0/gems/railties-4.0.0/lib/rails/application.rb:189:in `require_environment!'
/usr/local/rvm/gems/ruby-2.0.0-p353#railstutorial_rails_4_0/gems/railties-4.0.0/lib/rails/application.rb:249:in `block in run_tasks_blocks'
/usr/local/rvm/gems/ruby-2.0.0-p353#railstutorial_rails_4_0/bin/ruby_executable_hooks:15:in `eval'
/usr/local/rvm/gems/ruby-2.0.0-p353#railstutorial_rails_4_0/bin/ruby_executable_hooks:15:in `<main>'
Tasks: TOP => db:reset => environment
(See full trace by running task with --trace)
[app_folder]
I get similar errors when I try to run rails server or rails console. Would really appreciate any help!! Thanks a lot!
Usually rails apps have config/database.yml.example, copy this file to config/database.yml and overwrite database connection settings if necessary.

Run rails server command

I'm using ActiveAdmin framework, I followed the ActiveAdmin's getting started and in the last step rails generate active_admin:resource [MyModelName] I write this: rails generate active_admin:resource User then I tried to see the results in the browser so I run the server rails s and then I get this problem:
edu#edu-ThinkPad-Edge:~/Desktop/rails_proyects/fulbo$ rails server
=> Booting WEBrick
=> Rails 3.2.13 application starting in development on `http://0.0.0.0:3000`
=> Call with -d to detach
=> Ctrl-C to shutdown server Exiting /home/edu/Desktop/rails_proyects/fulbo/app/admin/users.rb:1:in `<top
(required)>': uninitialized constant User (NameError) from
/home/edu/.rvm/gems/ruby-1.9.3-p392#fulbo/gems/activeadmin-0.6.0/lib/active_admin/application.rb:179:in
`block in load!' from
/home/edu/.rvm/gems/ruby-1.9.3-p392#fulbo/gems/activeadmin-0.6.0/lib/active_admin/application.rb:179:in
`each' from
/home/edu/.rvm/gems/ruby-1.9.3-p392#fulbo/gems/activeadmin-0.6.0/lib/active_admin/application.rb:179:in
`load!' from
/home/edu/.rvm/gems/ruby-1.9.3-p392#fulbo/gems/activeadmin-0.6.0/lib/active_admin/application.rb:197:in
`routes' from
/home/edu/.rvm/gems/ruby-1.9.3-p392#fulbo/gems/activeadmin-0.6.0/lib/active_admin.rb:83:in
`routes' from
/home/edu/Desktop/rails_proyects/fulbo/config/routes.rb:3:in `block in
<top (required)>' from
/home/edu/.rvm/gems/ruby-1.9.3-p392#fulbo/gems/actionpack-3.2.13/lib/action_dispatch/routing/route_set.rb:289:in
`instance_exec' from
/home/edu/.rvm/gems/ruby-1.9.3-p392#fulbo/gems/actionpack-3.2.13/lib/action_dispatch/routing/route_set.rb:289:in
`eval_block' from
/home/edu/.rvm/gems/ruby-1.9.3-p392#fulbo/gems/actionpack-3.2.13/lib/action_dispatch/routing/route_set.rb:267:in
`draw' from
/home/edu/Desktop/rails_proyects/fulbo/config/routes.rb:1:in `<top
(required)>' from
/home/edu/.rvm/gems/ruby-1.9.3-p392#fulbo/gems/railties-3.2.13/lib/rails/application/routes_reloader.rb:40:in
`block in load_paths' from
/home/edu/.rvm/gems/ruby-1.9.3-p392#fulbo/gems/railties-3.2.13/lib/rails/application/routes_reloader.rb:40:in
`each' from
/home/edu/.rvm/gems/ruby-1.9.3-p392#fulbo/gems/railties-3.2.13/lib/rails/application/routes_reloader.rb:40:in
`load_paths' from
/home/edu/.rvm/gems/ruby-1.9.3-p392#fulbo/gems/railties-3.2.13/lib/rails/application/routes_reloader.rb:16:in
`reload!' from
/home/edu/.rvm/gems/ruby-1.9.3-p392#fulbo/gems/railties-3.2.13/lib/rails/application.rb:108:in `reload_routes!' from
/home/edu/.rvm/gems/ruby-1.9.3-p392#fulbo/gems/activeadmin-0.6.0/lib/active_admin/reloader.rb:34:in
`reload!' from
/home/edu/.rvm/gems/ruby-1.9.3-p392#fulbo/gems/activeadmin-0.6.0/lib/active_admin/reloader.rb:61:in
`block in attach!' from
/home/edu/.rvm/gems/ruby-1.9.3-p392#fulbo/gems/activesupport-3.2.13/lib/active_support/callbacks.rb:429:in
`_run__246534365__prepare__874865436__callbacks' from
/home/edu/.rvm/gems/ruby-1.9.3-p392#fulbo/gems/activesupport-3.2.13/lib/active_support/callbacks.rb:405:in
`__run_callback' from
/home/edu/.rvm/gems/ruby-1.9.3-p392#fulbo/gems/activesupport-3.2.13/lib/active_support/callbacks.rb:385:in
`_run_prepare_callbacks' from
/home/edu/.rvm/gems/ruby-1.9.3-p392#fulbo/gems/activesupport-3.2.13/lib/active_support/callbacks.rb:81:in
`run_callbacks' from
/home/edu/.rvm/gems/ruby-1.9.3-p392#fulbo/gems/actionpack-3.2.13/lib/action_dispatch/middleware/reloader.rb:74:in
`prepare!' from
/home/edu/.rvm/gems/ruby-1.9.3-p392#fulbo/gems/actionpack-3.2.13/lib/action_dispatch/middleware/reloader.rb:48:in
`prepare!' from
/home/edu/.rvm/gems/ruby-1.9.3-p392#fulbo/gems/railties-3.2.13/lib/rails/application/finisher.rb:47:in
`block in <module:Finisher>' from
/home/edu/.rvm/gems/ruby-1.9.3-p392#fulbo/gems/railties-3.2.13/lib/rails/initializable.rb:30:in `instance_exec' from
/home/edu/.rvm/gems/ruby-1.9.3-p392#fulbo/gems/railties-3.2.13/lib/rails/initializable.rb:30:in `run' from
/home/edu/.rvm/gems/ruby-1.9.3-p392#fulbo/gems/railties-3.2.13/lib/rails/initializable.rb:55:in `block in run_initializers' from
/home/edu/.rvm/gems/ruby-1.9.3-p392#fulbo/gems/railties-3.2.13/lib/rails/initializable.rb:54:in `each' from
/home/edu/.rvm/gems/ruby-1.9.3-p392#fulbo/gems/railties-3.2.13/lib/rails/initializable.rb:54:in `run_initializers' from
/home/edu/.rvm/gems/ruby-1.9.3-p392#fulbo/gems/railties-3.2.13/lib/rails/application.rb:136:in `initialize!' from
/home/edu/.rvm/gems/ruby-1.9.3-p392#fulbo/gems/railties-3.2.13/lib/rails/railtie/configurable.rb:30:in
`method_missing' from
/home/edu/Desktop/rails_proyects/fulbo/config/environment.rb:5:in
`<top (required)>' from
/home/edu/Desktop/rails_proyects/fulbo/config.ru:3:in `block in
<main>' from
/home/edu/.rvm/gems/ruby-1.9.3-p392#fulbo/gems/rack-1.4.5/lib/rack/builder.rb:51:in
`instance_eval' from
/home/edu/.rvm/gems/ruby-1.9.3-p392#fulbo/gems/rack-1.4.5/lib/rack/builder.rb:51:in
`initialize' from /home/edu/Desktop/rails_proyects/fulbo/config.ru:in
`new' from /home/edu/Desktop/rails_proyects/fulbo/config.ru:in
`<main>' from
/home/edu/.rvm/gems/ruby-1.9.3-p392#fulbo/gems/rack-1.4.5/lib/rack/builder.rb:40:in
`eval' from
/home/edu/.rvm/gems/ruby-1.9.3-p392#fulbo/gems/rack-1.4.5/lib/rack/builder.rb:40:in
`parse_file' from
/home/edu/.rvm/gems/ruby-1.9.3-p392#fulbo/gems/rack-1.4.5/lib/rack/server.rb:200:in
`app' from
/home/edu/.rvm/gems/ruby-1.9.3-p392#fulbo/gems/railties-3.2.13/lib/rails/commands/server.rb:46:in `app' from
/home/edu/.rvm/gems/ruby-1.9.3-p392#fulbo/gems/rack-1.4.5/lib/rack/server.rb:304:in
`wrapped_app' from
/home/edu/.rvm/gems/ruby-1.9.3-p392#fulbo/gems/rack-1.4.5/lib/rack/server.rb:254:in
`start' from
/home/edu/.rvm/gems/ruby-1.9.3-p392#fulbo/gems/railties-3.2.13/lib/rails/commands/server.rb:70:in `start' from
/home/edu/.rvm/gems/ruby-1.9.3-p392#fulbo/gems/railties-3.2.13/lib/rails/commands.rb:55:in
`block in <top (required)>' from
/home/edu/.rvm/gems/ruby-1.9.3-p392#fulbo/gems/railties-3.2.13/lib/rails/commands.rb:50:in
`tap' from
/home/edu/.rvm/gems/ruby-1.9.3-p392#fulbo/gems/railties-3.2.13/lib/rails/commands.rb:50:in
`<top (required)>' from script/rails:6:in `require' from
script/rails:6:in `<main>'
someone knows how to fix it or what's wrong.
The problem you are encountering is - ActiveAdmin is trying to generate resource on users, but model for users doesn't exist. Therefore, you will have to create a model User before you generate active_admin resource on User.
Do it as follows:
rm app/admin/users.rb
rails generate model User username: string email: string
bundle exec rake db:migrate
#this should be successful
rails generate active_admin:resource User
rails server
Let me know, if it helps you out. Comment with the errors you encounter.
Good luck

What should I do to make this rails app testable?

I have an up to date rails application, using rails 3.2 with mongoid 2. I was unable to start testing by typing rake. The exception thrown is (sanitized):
rake test
/railsapp/app/models/image.rb:18:in `<class:Image>': undefined method `[]' for nil:NilClass (NoMethodError)
from /railsapp/app/models/image.rb:1:in `<top (required)>'
from /gems/activesupport-3.2.8/lib/active_support/dependencies.rb:251:in `require'
from /gems/activesupport-3.2.8/lib/active_support/dependencies.rb:251:in `block in require'
from /gems/activesupport-3.2.8/lib/active_support/dependencies.rb:236:in `load_dependency'
from /gems/activesupport-3.2.8/lib/active_support/dependencies.rb:251:in `require'
from /gems/activesupport-3.2.8/lib/active_support/dependencies.rb:359:in `require_or_load'
from /gems/activesupport-3.2.8/lib/active_support/dependencies.rb:313:in `depend_on'
from /gems/activesupport-3.2.8/lib/active_support/dependencies.rb:225:in `require_dependency'
from /gems/railties-3.2.8/lib/rails/engine.rb:439:in `block (2 levels) in eager_load!'
from /gems/railties-3.2.8/lib/rails/engine.rb:438:in `each'
from /gems/railties-3.2.8/lib/rails/engine.rb:438:in `block in eager_load!'
from /gems/railties-3.2.8/lib/rails/engine.rb:436:in `each'
from /gems/railties-3.2.8/lib/rails/engine.rb:436:in `eager_load!'
from /gems/railties-3.2.8/lib/rails/application/finisher.rb:53:in `block in <module:Finisher>'
from /gems/railties-3.2.8/lib/rails/initializable.rb:30:in `instance_exec'
from /gems/railties-3.2.8/lib/rails/initializable.rb:30:in `run'
from /gems/railties-3.2.8/lib/rails/initializable.rb:55:in `block in run_initializers'
from /gems/railties-3.2.8/lib/rails/initializable.rb:54:in `each'
from /gems/railties-3.2.8/lib/rails/initializable.rb:54:in `run_initializers'
from /gems/railties-3.2.8/lib/rails/application.rb:136:in `initialize!'
from /gems/railties-3.2.8/lib/rails/railtie/configurable.rb:30:in `method_missing'
from /railsapp/config/environment.rb:7:in `<top (required)>'
from /railsapp/test/test_helper.rb:2:in `require'
from /railsapp/test/test_helper.rb:2:in `<top (required)>'
from /railsapp/test/unit/post_test.rb:1:in `require'
from /railsapp/test/unit/post_test.rb:1:in `<top (required)>'
from /gems/rake-0.9.2.2/lib/rake/rake_test_loader.rb:10:in `require'
from /gems/rake-0.9.2.2/lib/rake/rake_test_loader.rb:10:in `block (2 levels) in <main>'
from /gems/rake-0.9.2.2/lib/rake/rake_test_loader.rb:9:in `each'
from /gems/rake-0.9.2.2/lib/rake/rake_test_loader.rb:9:in `block in <main>'
from /gems/rake-0.9.2.2/lib/rake/rake_test_loader.rb:4:in `select'
from /gems/rake-0.9.2.2/lib/rake/rake_test_loader.rb:4:in `<main>'
Errors running test:units! #<RuntimeError: Command failed with status (1): [/Users/janlimpens/.rvm/rubies/ruby-1.9.3-p...]>
I created a gist with the files that are of interest in the context:
https://gist.github.com/3989760
There is no test concerning the image model at all, there are no fixtures and the only test I have got is included into the gist, but it is not to blame, the error is thrown upon including test_helper.rb.
What are my options?
When the tests start Rails loads up, as it does so it evaluates all of your models.
This includes the Image model, which apparently has a bug or typo on line 18.
Which would be this line:
:path => "#{APP_CONFIG['uploads_dir']}/:class/:id/:attachment/:style.:extension",
The only array notation here is:
APP_CONFIG['uploads_dir']
So, where is APP_CONFIG defined? And why is it a nil? These are the questions we must answer.
You might start by grepping your project for this string.

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

Getting a NameError when upgrading my app to rails 3.1.1

The name of my app is newsample_app . I am following along the railstutorial screencast for upgrading to rails 3.1. Here is the error message I am getting when copying files over from my old "sample_app" to "newsample_app" and trying to run rspec:
rspec spec/controllers/pages_controller_spec.rb
/Users/topica/rails_projects/newsample_app/config/routes.rb:1:in `': uninitialized constant NewSampleApp (NameError)
After seeing this, I changed my routes.rb file from my original sample_app from "SampleApp::Application.routes.draw do" to this: "NewSampleApp::Application.routes.draw do" but am still getting the error. Any ideas?
FYI complete error:
Topicas-MacBook-Pro:newsample_app topica$ rspec spec/controllers/pages_controller_spec.rb
/Users/topica/rails_projects/newsample_app/config/routes.rb:1:in `<top (required)>': uninitialized constant NewSampleApp (NameError)
from /Users/topica/.rvm/gems/ruby-1.9.2-p290#rails3_1tutorial/gems/railties-3.1.1/lib/rails/application/routes_reloader.rb:29:in `block in load_paths'
from /Users/topica/.rvm/gems/ruby-1.9.2-p290#rails3_1tutorial/gems/railties-3.1.1/lib/rails/application/routes_reloader.rb:29:in `each'
from /Users/topica/.rvm/gems/ruby-1.9.2-p290#rails3_1tutorial/gems/railties-3.1.1/lib/rails/application/routes_reloader.rb:29:in `load_paths'
from /Users/topica/.rvm/gems/ruby-1.9.2-p290#rails3_1tutorial/gems/railties-3.1.1/lib/rails/application/routes_reloader.rb:13:in `reload!'
from /Users/topica/.rvm/gems/ruby-1.9.2-p290#rails3_1tutorial/gems/railties-3.1.1/lib/rails/application/routes_reloader.rb:7:in `block in initialize'
from /Users/topica/.rvm/gems/ruby-1.9.2-p290#rails3_1tutorial/gems/activesupport-3.1.1/lib/active_support/file_update_checker.rb:32:in `call'
from /Users/topica/.rvm/gems/ruby-1.9.2-p290#rails3_1tutorial/gems/activesupport-3.1.1/lib/active_support/file_update_checker.rb:32:in `execute_if_updated'
from /Users/topica/.rvm/gems/ruby-1.9.2-p290#rails3_1tutorial/gems/railties-3.1.1/lib/rails/application/finisher.rb:63:in `block (2 levels) in <module:Finisher>'
from /Users/topica/.rvm/gems/ruby-1.9.2-p290#rails3_1tutorial/gems/railties-3.1.1/lib/rails/application/finisher.rb:64:in `call'
from /Users/topica/.rvm/gems/ruby-1.9.2-p290#rails3_1tutorial/gems/railties-3.1.1/lib/rails/application/finisher.rb:64:in `block in <module:Finisher>'
from /Users/topica/.rvm/gems/ruby-1.9.2-p290#rails3_1tutorial/gems/railties-3.1.1/lib/rails/initializable.rb:30:in `instance_exec'
from /Users/topica/.rvm/gems/ruby-1.9.2-p290#rails3_1tutorial/gems/railties-3.1.1/lib/rails/initializable.rb:30:in `run'
from /Users/topica/.rvm/gems/ruby-1.9.2-p290#rails3_1tutorial/gems/railties-3.1.1/lib/rails/initializable.rb:55:in `block in run_initializers'
from /Users/topica/.rvm/gems/ruby-1.9.2-p290#rails3_1tutorial/gems/railties-3.1.1/lib/rails/initializable.rb:54:in `each'
from /Users/topica/.rvm/gems/ruby-1.9.2-p290#rails3_1tutorial/gems/railties-3.1.1/lib/rails/initializable.rb:54:in `run_initializers'
from /Users/topica/.rvm/gems/ruby-1.9.2-p290#rails3_1tutorial/gems/railties-3.1.1/lib/rails/application.rb:96:in `initialize!'
from /Users/topica/.rvm/gems/ruby-1.9.2-p290#rails3_1tutorial/gems/railties-3.1.1/lib/rails/railtie/configurable.rb:30:in `method_missing'
from /Users/topica/rails_projects/newsample_app/config/environment.rb:5:in `<top (required)>'
from /Users/topica/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
from /Users/topica/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
from /Users/topica/rails_projects/newsample_app/spec/spec_helper.rb:3:in `<top (required)>'
from /Users/topica/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
from /Users/topica/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
from /Users/topica/rails_projects/newsample_app/spec/controllers/pages_controller_spec.rb:1:in `<top (required)>'
from /Users/topica/.rvm/gems/ruby-1.9.2-p290#rails3_1tutorial/gems/rspec-core-2.6.4/lib/rspec/core/configuration.rb:419:in `load'
from /Users/topica/.rvm/gems/ruby-1.9.2-p290#rails3_1tutorial/gems/rspec-core-2.6.4/lib/rspec/core/configuration.rb:419:in `block in load_spec_files'
from /Users/topica/.rvm/gems/ruby-1.9.2-p290#rails3_1tutorial/gems/rspec-core-2.6.4/lib/rspec/core/configuration.rb:419:in `map'
from /Users/topica/.rvm/gems/ruby-1.9.2-p290#rails3_1tutorial/gems/rspec-core-2.6.4/lib/rspec/core/configuration.rb:419:in `load_spec_files'
from /Users/topica/.rvm/gems/ruby-1.9.2-p290#rails3_1tutorial/gems/rspec-core-2.6.4/lib/rspec/core/command_line.rb:18:in `run'
from /Users/topica/.rvm/gems/ruby-1.9.2-p290#rails3_1tutorial/gems/rspec-core-2.6.4/lib/rspec/core/runner.rb:80:in `run_in_process'
from /Users/topica/.rvm/gems/ruby-1.9.2-p290#rails3_1tutorial/gems/rspec-core-2.6.4/lib/rspec/core/runner.rb:69:in `run'
from /Users/topica/.rvm/gems/ruby-1.9.2-p290#rails3_1tutorial/gems/rspec-core-2.6.4/lib/rspec/core/runner.rb:11:in `block in autorun'
You probably want that to match the same as in config/application.rb
If it really is newsample_app than it is probably NewsampleApp not NewSampleApp
Looks like a case problem.
> "newsample_app".camelize
=> "NewsampleApp"
Note the lowercase "s".

Resources