I am not using the Rails API gem but I am trying to build an api in Rails. I am using the devise gem and the devise_token_auth gem. I just ran the line:
rails g devise_token_auth:install FacilityUser auth
The generate command adbove worked but now my server won't start. The problem is with my routes.rb file.
Rails.application.routes.draw do
devise_for :facility_users, ActiveAdmin::Devise.config
devise_for :users, controllers: {registrations: "users/registrations", sessions: "users/sessions", passwords: "users/passwords"}, skip: [:sessions, :registrations]
root 'landings#index'
mount_devise_token_auth_for 'FacilityUser', at: 'auth'
end
When my route file is as above, I get the following error in my logs when I try to start the server:
davids-MacBook-Pro:waynefacility davidmurray$ rails s
=> Booting WEBrick
=> Rails 4.1.4 application starting in development on http://0.0.0.0:3000
=> Run `rails server -h` for more startup options
=> Notice: server is listening on all interfaces (0.0.0.0). Consider using 127.0.0.1 (--binding option)
=> Ctrl-C to shutdown server
Exiting
/Users/davidmurray/.rvm/gems/ruby-2.2.0/gems/actionpack-4.1.4/lib/action_dispatch/routing/route_set.rb:430:in `add_route': Invalid route name, already in use: 'new_facility_user_session' (ArgumentError)
You may have defined two routes with the same name using the `:as` option, or you may be overriding a route already defined by a resource with the same naming. For the latter, you can restrict the routes created with `resources` as explained here:
http://guides.rubyonrails.org/routing.html#restricting-the-routes-created
from /Users/davidmurray/.rvm/gems/ruby-2.2.0/gems/actionpack-4.1.4/lib/action_dispatch/routing/mapper.rb:1489:in `add_route'
from /Users/davidmurray/.rvm/gems/ruby-2.2.0/gems/actionpack-4.1.4/lib/action_dispatch/routing/mapper.rb:1466:in `decomposed_match'
from /Users/davidmurray/.rvm/gems/ruby-2.2.0/gems/actionpack-4.1.4/lib/action_dispatch/routing/mapper.rb:1464:in `block in decomposed_match'
from /Users/davidmurray/.rvm/gems/ruby-2.2.0/gems/actionpack-4.1.4/lib/action_dispatch/routing/mapper.rb:1362:in `block (2 levels) in member'
from /Users/davidmurray/.rvm/gems/ruby-2.2.0/gems/actionpack-4.1.4/lib/action_dispatch/routing/mapper.rb:757:in `scope'
from /Users/davidmurray/.rvm/gems/ruby-2.2.0/gems/actionpack-4.1.4/lib/action_dispatch/routing/mapper.rb:1362:in `block in member'
from /Users/davidmurray/.rvm/gems/ruby-2.2.0/gems/actionpack-4.1.4/lib/action_dispatch/routing/mapper.rb:1594:in `with_scope_level'
from /Users/davidmurray/.rvm/gems/ruby-2.2.0/gems/actionpack-4.1.4/lib/action_dispatch/routing/mapper.rb:1358:in `member'
from /Users/davidmurray/.rvm/gems/ruby-2.2.0/gems/actionpack-4.1.4/lib/action_dispatch/routing/mapper.rb:1464:in `decomposed_match'
from /Users/davidmurray/.rvm/gems/ruby-2.2.0/gems/actionpack-4.1.4/lib/action_dispatch/routing/mapper.rb:1447:in `block in match'
from /Users/davidmurray/.rvm/gems/ruby-2.2.0/gems/actionpack-4.1.4/lib/action_dispatch/routing/mapper.rb:1437:in `each'
from /Users/davidmurray/.rvm/gems/ruby-2.2.0/gems/actionpack-4.1.4/lib/action_dispatch/routing/mapper.rb:1437:in `match'
from /Users/davidmurray/.rvm/gems/ruby-2.2.0/gems/actionpack-4.1.4/lib/action_dispatch/routing/mapper.rb:630:in `map_method'
from /Users/davidmurray/.rvm/gems/ruby-2.2.0/gems/actionpack-4.1.4/lib/action_dispatch/routing/mapper.rb:591:in `get'
from /Users/davidmurray/.rvm/gems/ruby-2.2.0/bundler/gems/devise-69bee06ceee6/lib/devise/rails/routes.rb:377:in `block in devise_session'
from /Users/davidmurray/.rvm/gems/ruby-2.2.0/gems/actionpack-4.1.4/lib/action_dispatch/routing/mapper.rb:1141:in `block in resource'
from /Users/davidmurray/.rvm/gems/ruby-2.2.0/gems/actionpack-4.1.4/lib/action_dispatch/routing/mapper.rb:1605:in `block (2 levels) in resource_scope'
from /Users/davidmurray/.rvm/gems/ruby-2.2.0/gems/actionpack-4.1.4/lib/action_dispatch/routing/mapper.rb:757:in `scope'
from /Users/davidmurray/.rvm/gems/ruby-2.2.0/gems/actionpack-4.1.4/lib/action_dispatch/routing/mapper.rb:1605:in `block in resource_scope'
from /Users/davidmurray/.rvm/gems/ruby-2.2.0/gems/actionpack-4.1.4/lib/action_dispatch/routing/mapper.rb:1594:in `with_scope_level'
from /Users/davidmurray/.rvm/gems/ruby-2.2.0/gems/actionpack-4.1.4/lib/action_dispatch/routing/mapper.rb:1604:in `resource_scope'
from /Users/davidmurray/.rvm/gems/ruby-2.2.0/gems/actionpack-4.1.4/lib/action_dispatch/routing/mapper.rb:1140:in `resource'
from /Users/davidmurray/.rvm/gems/ruby-2.2.0/bundler/gems/devise-69bee06ceee6/lib/devise/rails/routes.rb:376:in `devise_session'
from /Users/davidmurray/.rvm/gems/ruby-2.2.0/bundler/gems/devise-69bee06ceee6/lib/devise/rails/routes.rb:266:in `block (4 levels) in devise_for'
from /Users/davidmurray/.rvm/gems/ruby-2.2.0/bundler/gems/devise-69bee06ceee6/lib/devise/rails/routes.rb:266:in `each'
from /Users/davidmurray/.rvm/gems/ruby-2.2.0/bundler/gems/devise-69bee06ceee6/lib/devise/rails/routes.rb:266:in `block (3 levels) in devise_for'
from /Users/davidmurray/.rvm/gems/ruby-2.2.0/bundler/gems/devise-69bee06ceee6/lib/devise/rails/routes.rb:470:in `with_devise_exclusive_scope'
from /Users/davidmurray/.rvm/gems/ruby-2.2.0/bundler/gems/devise-69bee06ceee6/lib/devise/rails/routes.rb:265:in `block (2 levels) in devise_for'
from /Users/davidmurray/.rvm/gems/ruby-2.2.0/bundler/gems/devise-69bee06ceee6/lib/devise/rails/routes.rb:368:in `block in devise_scope'
from /Users/davidmurray/.rvm/gems/ruby-2.2.0/gems/actionpack-4.1.4/lib/action_dispatch/routing/mapper.rb:881:in `block in constraints'
from /Users/davidmurray/.rvm/gems/ruby-2.2.0/gems/actionpack-4.1.4/lib/action_dispatch/routing/mapper.rb:757:in `scope'
from /Users/davidmurray/.rvm/gems/ruby-2.2.0/gems/actionpack-4.1.4/lib/action_dispatch/routing/mapper.rb:881:in `constraints'
from /Users/davidmurray/.rvm/gems/ruby-2.2.0/bundler/gems/devise-69bee06ceee6/lib/devise/rails/routes.rb:367:in `devise_scope'
from /Users/davidmurray/.rvm/gems/ruby-2.2.0/bundler/gems/devise-69bee06ceee6/lib/devise/rails/routes.rb:264:in `block in devise_for'
from /Users/davidmurray/.rvm/gems/ruby-2.2.0/bundler/gems/devise-69bee06ceee6/lib/devise/rails/routes.rb:240:in `each'
from /Users/davidmurray/.rvm/gems/ruby-2.2.0/bundler/gems/devise-69bee06ceee6/lib/devise/rails/routes.rb:240:in `devise_for'
from /Users/davidmurray/.rvm/gems/ruby-2.2.0/gems/devise_token_auth-0.1.37/lib/devise_token_auth/rails/routes.rb:25:in `mount_devise_token_auth_for'
from /Users/davidmurray/projects/waynefacility/config/routes.rb:14:in `block in <top (required)>'
from /Users/davidmurray/.rvm/gems/ruby-2.2.0/gems/actionpack-4.1.4/lib/action_dispatch/routing/route_set.rb:337:in `instance_exec'
from /Users/davidmurray/.rvm/gems/ruby-2.2.0/gems/actionpack-4.1.4/lib/action_dispatch/routing/route_set.rb:337:in `eval_block'
from /Users/davidmurray/.rvm/gems/ruby-2.2.0/gems/actionpack-4.1.4/lib/action_dispatch/routing/route_set.rb:315:in `draw'
from /Users/davidmurray/projects/waynefacility/config/routes.rb:1:in `<top (required)>'
from /Users/davidmurray/.rvm/gems/ruby-2.2.0/gems/activesupport-4.1.4/lib/active_support/dependencies.rb:241:in `load'
from /Users/davidmurray/.rvm/gems/ruby-2.2.0/gems/activesupport-4.1.4/lib/active_support/dependencies.rb:241:in `block in load'
from /Users/davidmurray/.rvm/gems/ruby-2.2.0/gems/activesupport-4.1.4/lib/active_support/dependencies.rb:232:in `load_dependency'
from /Users/davidmurray/.rvm/gems/ruby-2.2.0/gems/activesupport-4.1.4/lib/active_support/dependencies.rb:241:in `load'
from /Users/davidmurray/.rvm/gems/ruby-2.2.0/gems/railties-4.1.4/lib/rails/application/routes_reloader.rb:40:in `block in load_paths'
from /Users/davidmurray/.rvm/gems/ruby-2.2.0/gems/railties-4.1.4/lib/rails/application/routes_reloader.rb:40:in `each'
from /Users/davidmurray/.rvm/gems/ruby-2.2.0/gems/railties-4.1.4/lib/rails/application/routes_reloader.rb:40:in `load_paths'
from /Users/davidmurray/.rvm/gems/ruby-2.2.0/gems/railties-4.1.4/lib/rails/application/routes_reloader.rb:16:in `reload!'
from /Users/davidmurray/.rvm/gems/ruby-2.2.0/gems/railties-4.1.4/lib/rails/application/routes_reloader.rb:26:in `block in updater'
from /Users/davidmurray/.rvm/gems/ruby-2.2.0/gems/activesupport-4.1.4/lib/active_support/file_update_checker.rb:75:in `call'
from /Users/davidmurray/.rvm/gems/ruby-2.2.0/gems/activesupport-4.1.4/lib/active_support/file_update_checker.rb:75:in `execute'
from /Users/davidmurray/.rvm/gems/ruby-2.2.0/gems/railties-4.1.4/lib/rails/application/routes_reloader.rb:27:in `updater'
from /Users/davidmurray/.rvm/gems/ruby-2.2.0/gems/railties-4.1.4/lib/rails/application/routes_reloader.rb:7:in `execute_if_updated'
from /Users/davidmurray/.rvm/gems/ruby-2.2.0/gems/railties-4.1.4/lib/rails/application/finisher.rb:71:in `block in <module:Finisher>'
from /Users/davidmurray/.rvm/gems/ruby-2.2.0/gems/railties-4.1.4/lib/rails/initializable.rb:30:in `instance_exec'
from /Users/davidmurray/.rvm/gems/ruby-2.2.0/gems/railties-4.1.4/lib/rails/initializable.rb:30:in `run'
from /Users/davidmurray/.rvm/gems/ruby-2.2.0/gems/railties-4.1.4/lib/rails/initializable.rb:55:in `block in run_initializers'
from /Users/davidmurray/.rvm/rubies/ruby-2.2.0/lib/ruby/2.2.0/tsort.rb:226:in `block in tsort_each'
from /Users/davidmurray/.rvm/rubies/ruby-2.2.0/lib/ruby/2.2.0/tsort.rb:348:in `block (2 levels) in each_strongly_connected_component'
from /Users/davidmurray/.rvm/rubies/ruby-2.2.0/lib/ruby/2.2.0/tsort.rb:429:in `each_strongly_connected_component_from'
from /Users/davidmurray/.rvm/rubies/ruby-2.2.0/lib/ruby/2.2.0/tsort.rb:347:in `block in each_strongly_connected_component'
from /Users/davidmurray/.rvm/rubies/ruby-2.2.0/lib/ruby/2.2.0/tsort.rb:345:in `each'
from /Users/davidmurray/.rvm/rubies/ruby-2.2.0/lib/ruby/2.2.0/tsort.rb:345:in `call'
from /Users/davidmurray/.rvm/rubies/ruby-2.2.0/lib/ruby/2.2.0/tsort.rb:345:in `each_strongly_connected_component'
from /Users/davidmurray/.rvm/rubies/ruby-2.2.0/lib/ruby/2.2.0/tsort.rb:224:in `tsort_each'
from /Users/davidmurray/.rvm/rubies/ruby-2.2.0/lib/ruby/2.2.0/tsort.rb:203:in `tsort_each'
from /Users/davidmurray/.rvm/gems/ruby-2.2.0/gems/railties-4.1.4/lib/rails/initializable.rb:54:in `run_initializers'
from /Users/davidmurray/.rvm/gems/ruby-2.2.0/gems/railties-4.1.4/lib/rails/application.rb:300:in `initialize!'
from /Users/davidmurray/projects/waynefacility/config/environment.rb:5:in `<top (required)>'
from /Users/davidmurray/.rvm/gems/ruby-2.2.0/gems/activesupport-4.1.4/lib/active_support/dependencies.rb:247:in `require'
from /Users/davidmurray/.rvm/gems/ruby-2.2.0/gems/activesupport-4.1.4/lib/active_support/dependencies.rb:247:in `block in require'
from /Users/davidmurray/.rvm/gems/ruby-2.2.0/gems/activesupport-4.1.4/lib/active_support/dependencies.rb:232:in `load_dependency'
from /Users/davidmurray/.rvm/gems/ruby-2.2.0/gems/activesupport-4.1.4/lib/active_support/dependencies.rb:247:in `require'
from /Users/davidmurray/projects/waynefacility/config.ru:3:in `block in <main>'
from /Users/davidmurray/.rvm/gems/ruby-2.2.0/gems/rack-1.5.5/lib/rack/builder.rb:55:in `instance_eval'
from /Users/davidmurray/.rvm/gems/ruby-2.2.0/gems/rack-1.5.5/lib/rack/builder.rb:55:in `initialize'
from /Users/davidmurray/projects/waynefacility/config.ru:in `new'
from /Users/davidmurray/projects/waynefacility/config.ru:in `<main>'
from /Users/davidmurray/.rvm/gems/ruby-2.2.0/gems/rack-1.5.5/lib/rack/builder.rb:49:in `eval'
from /Users/davidmurray/.rvm/gems/ruby-2.2.0/gems/rack-1.5.5/lib/rack/builder.rb:49:in `new_from_string'
from /Users/davidmurray/.rvm/gems/ruby-2.2.0/gems/rack-1.5.5/lib/rack/builder.rb:40:in `parse_file'
from /Users/davidmurray/.rvm/gems/ruby-2.2.0/gems/rack-1.5.5/lib/rack/server.rb:277:in `build_app_and_options_from_config'
from /Users/davidmurray/.rvm/gems/ruby-2.2.0/gems/rack-1.5.5/lib/rack/server.rb:199:in `app'
from /Users/davidmurray/.rvm/gems/ruby-2.2.0/gems/railties-4.1.4/lib/rails/commands/server.rb:50:in `app'
from /Users/davidmurray/.rvm/gems/ruby-2.2.0/gems/rack-1.5.5/lib/rack/server.rb:314:in `wrapped_app'
from /Users/davidmurray/.rvm/gems/ruby-2.2.0/gems/railties-4.1.4/lib/rails/commands/server.rb:130:in `log_to_stdout'
from /Users/davidmurray/.rvm/gems/ruby-2.2.0/gems/railties-4.1.4/lib/rails/commands/server.rb:67:in `start'
from /Users/davidmurray/.rvm/gems/ruby-2.2.0/gems/railties-4.1.4/lib/rails/commands/commands_tasks.rb:81:in `block in server'
from /Users/davidmurray/.rvm/gems/ruby-2.2.0/gems/railties-4.1.4/lib/rails/commands/commands_tasks.rb:76:in `tap'
from /Users/davidmurray/.rvm/gems/ruby-2.2.0/gems/railties-4.1.4/lib/rails/commands/commands_tasks.rb:76:in `server'
from /Users/davidmurray/.rvm/gems/ruby-2.2.0/gems/railties-4.1.4/lib/rails/commands/commands_tasks.rb:40:in `run_command!'
from /Users/davidmurray/.rvm/gems/ruby-2.2.0/gems/railties-4.1.4/lib/rails/commands.rb:17:in `<top (required)>'
from bin/rails:4:in `require'
from bin/rails:4:in `<main>'
If I change the order of routes so that mount_devise_token_auth_for 'FacilityUser', at: 'auth' is the first line, then I get the following error:
davids-MacBook-Pro:waynefacility davidmurray$ rails s
=> Booting WEBrick
=> Rails 4.1.4 application starting in development on http://0.0.0.0:3000
=> Run `rails server -h` for more startup options
=> Notice: server is listening on all interfaces (0.0.0.0). Consider using 127.0.0.1 (--binding option)
=> Ctrl-C to shutdown server
Exiting
/Users/davidmurray/.rvm/gems/ruby-2.2.0/gems/devise_token_auth-0.1.37/lib/devise_token_auth/rails/routes.rb:40:in `block in mount_devise_token_auth_for': uninitialized constant ActionDispatch::Routing::Mapper::Scope (NameError)
from /Users/davidmurray/.rvm/gems/ruby-2.2.0/gems/devise_token_auth-0.1.37/lib/devise_token_auth/rails/routes.rb:86:in `unnest_namespace'
from /Users/davidmurray/.rvm/gems/ruby-2.2.0/gems/devise_token_auth-0.1.37/lib/devise_token_auth/rails/routes.rb:32:in `mount_devise_token_auth_for'
from /Users/davidmurray/projects/waynefacility/config/routes.rb:2:in `block in <top (required)>'
from /Users/davidmurray/.rvm/gems/ruby-2.2.0/gems/actionpack-4.1.4/lib/action_dispatch/routing/route_set.rb:337:in `instance_exec'
from /Users/davidmurray/.rvm/gems/ruby-2.2.0/gems/actionpack-4.1.4/lib/action_dispatch/routing/route_set.rb:337:in `eval_block'
from /Users/davidmurray/.rvm/gems/ruby-2.2.0/gems/actionpack-4.1.4/lib/action_dispatch/routing/route_set.rb:315:in `draw'
from /Users/davidmurray/projects/waynefacility/config/routes.rb:1:in `<top (required)>'
from /Users/davidmurray/.rvm/gems/ruby-2.2.0/gems/railties-4.1.4/lib/rails/application/routes_reloader.rb:40:in `block in load_paths'
from /Users/davidmurray/.rvm/gems/ruby-2.2.0/gems/railties-4.1.4/lib/rails/application/routes_reloader.rb:40:in `each'
from /Users/davidmurray/.rvm/gems/ruby-2.2.0/gems/railties-4.1.4/lib/rails/application/routes_reloader.rb:40:in `load_paths'
from /Users/davidmurray/.rvm/gems/ruby-2.2.0/gems/railties-4.1.4/lib/rails/application/routes_reloader.rb:16:in `reload!'
from /Users/davidmurray/.rvm/gems/ruby-2.2.0/gems/railties-4.1.4/lib/rails/application/routes_reloader.rb:26:in `block in updater'
from /Users/davidmurray/.rvm/gems/ruby-2.2.0/gems/activesupport-4.1.4/lib/active_support/file_update_checker.rb:75:in `call'
from /Users/davidmurray/.rvm/gems/ruby-2.2.0/gems/activesupport-4.1.4/lib/active_support/file_update_checker.rb:75:in `execute'
from /Users/davidmurray/.rvm/gems/ruby-2.2.0/gems/railties-4.1.4/lib/rails/application/routes_reloader.rb:27:in `updater'
from /Users/davidmurray/.rvm/gems/ruby-2.2.0/gems/railties-4.1.4/lib/rails/application/routes_reloader.rb:7:in `execute_if_updated'
from /Users/davidmurray/.rvm/gems/ruby-2.2.0/gems/railties-4.1.4/lib/rails/application/finisher.rb:71:in `block in <module:Finisher>'
from /Users/davidmurray/.rvm/gems/ruby-2.2.0/gems/railties-4.1.4/lib/rails/initializable.rb:30:in `instance_exec'
from /Users/davidmurray/.rvm/gems/ruby-2.2.0/gems/railties-4.1.4/lib/rails/initializable.rb:30:in `run'
from /Users/davidmurray/.rvm/gems/ruby-2.2.0/gems/railties-4.1.4/lib/rails/initializable.rb:55:in `block in run_initializers'
from /Users/davidmurray/.rvm/rubies/ruby-2.2.0/lib/ruby/2.2.0/tsort.rb:226:in `block in tsort_each'
from /Users/davidmurray/.rvm/rubies/ruby-2.2.0/lib/ruby/2.2.0/tsort.rb:348:in `block (2 levels) in each_strongly_connected_component'
from /Users/davidmurray/.rvm/rubies/ruby-2.2.0/lib/ruby/2.2.0/tsort.rb:429:in `each_strongly_connected_component_from'
from /Users/davidmurray/.rvm/rubies/ruby-2.2.0/lib/ruby/2.2.0/tsort.rb:347:in `block in each_strongly_connected_component'
from /Users/davidmurray/.rvm/rubies/ruby-2.2.0/lib/ruby/2.2.0/tsort.rb:345:in `each'
from /Users/davidmurray/.rvm/rubies/ruby-2.2.0/lib/ruby/2.2.0/tsort.rb:345:in `call'
from /Users/davidmurray/.rvm/rubies/ruby-2.2.0/lib/ruby/2.2.0/tsort.rb:345:in `each_strongly_connected_component'
from /Users/davidmurray/.rvm/rubies/ruby-2.2.0/lib/ruby/2.2.0/tsort.rb:224:in `tsort_each'
from /Users/davidmurray/.rvm/rubies/ruby-2.2.0/lib/ruby/2.2.0/tsort.rb:203:in `tsort_each'
from /Users/davidmurray/.rvm/gems/ruby-2.2.0/gems/railties-4.1.4/lib/rails/initializable.rb:54:in `run_initializers'
from /Users/davidmurray/.rvm/gems/ruby-2.2.0/gems/railties-4.1.4/lib/rails/application.rb:300:in `initialize!'
from /Users/davidmurray/projects/waynefacility/config/environment.rb:5:in `<top (required)>'
from /Users/davidmurray/projects/waynefacility/config.ru:3:in `block in <main>'
from /Users/davidmurray/.rvm/gems/ruby-2.2.0/gems/rack-1.5.5/lib/rack/builder.rb:55:in `instance_eval'
from /Users/davidmurray/.rvm/gems/ruby-2.2.0/gems/rack-1.5.5/lib/rack/builder.rb:55:in `initialize'
from /Users/davidmurray/projects/waynefacility/config.ru:in `new'
from /Users/davidmurray/projects/waynefacility/config.ru:in `<main>'
from /Users/davidmurray/.rvm/gems/ruby-2.2.0/gems/rack-1.5.5/lib/rack/builder.rb:49:in `eval'
from /Users/davidmurray/.rvm/gems/ruby-2.2.0/gems/rack-1.5.5/lib/rack/builder.rb:49:in `new_from_string'
from /Users/davidmurray/.rvm/gems/ruby-2.2.0/gems/rack-1.5.5/lib/rack/builder.rb:40:in `parse_file'
from /Users/davidmurray/.rvm/gems/ruby-2.2.0/gems/rack-1.5.5/lib/rack/server.rb:277:in `build_app_and_options_from_config'
from /Users/davidmurray/.rvm/gems/ruby-2.2.0/gems/rack-1.5.5/lib/rack/server.rb:199:in `app'
from /Users/davidmurray/.rvm/gems/ruby-2.2.0/gems/railties-4.1.4/lib/rails/commands/server.rb:50:in `app'
from /Users/davidmurray/.rvm/gems/ruby-2.2.0/gems/rack-1.5.5/lib/rack/server.rb:314:in `wrapped_app'
from /Users/davidmurray/.rvm/gems/ruby-2.2.0/gems/railties-4.1.4/lib/rails/commands/server.rb:130:in `log_to_stdout'
from /Users/davidmurray/.rvm/gems/ruby-2.2.0/gems/railties-4.1.4/lib/rails/commands/server.rb:67:in `start'
from /Users/davidmurray/.rvm/gems/ruby-2.2.0/gems/railties-4.1.4/lib/rails/commands/commands_tasks.rb:81:in `block in server'
from /Users/davidmurray/.rvm/gems/ruby-2.2.0/gems/railties-4.1.4/lib/rails/commands/commands_tasks.rb:76:in `tap'
from /Users/davidmurray/.rvm/gems/ruby-2.2.0/gems/railties-4.1.4/lib/rails/commands/commands_tasks.rb:76:in `server'
from /Users/davidmurray/.rvm/gems/ruby-2.2.0/gems/railties-4.1.4/lib/rails/commands/commands_tasks.rb:40:in `run_command!'
from /Users/davidmurray/.rvm/gems/ruby-2.2.0/gems/railties-4.1.4/lib/rails/commands.rb:17:in `<top (required)>'
from bin/rails:4:in `require'
from bin/rails:4:in `<main>'
I tried commenting out a bunch of the routes so all i have is:
mount_devise_token_auth_for 'FacilityUser', at: 'auth'
root 'landings#index'
but then i still get the same block in mount_devise_token_auth_for': uninitialized constant ActionDispatch::Routing::Mapper::Scope (NameError) error.
How do I fix this?
I used like this. It worked for me.
# token auth routes available at /api/v1/auth
namespace :api do
scope :v1 do
mount_devise_token_auth_for 'User', at: 'auth'
end
end
# devise_for :users
devise_for :users, controllers: {
sessions: 'users/sessions',
registrations: 'users/registrations'
}
As you are using devise_token_auth you should mount you route like this:
Rails.application.routes.draw do
# This one conflicts with mount_devise_token_auth,
# if you want to use devise_token_auth you should only use
# mount_devise_token_auth_for.
# devise_for :facility_users, ActiveAdmin::Devise.config
devise_for :users, controllers: { registrations: "users/registrations",
sessions: "users/sessions",
passwords: "users/passwords" },
skip: [:sessions, :registrations]
root 'landings#index'
mount_devise_token_auth_for 'FacilityUser', at: 'auth'
end
It should work.
Related
My rails server doesn't work for one project, but DOES work for another project.
For the project that does not work, when I run rails s in my terminal I get the the following output:
=> Booting Thin
=> Rails 4.1.0 application starting in development on http://0.0.0.0:3000
=> Run `rails server -h` for more startup options
=> Notice: server is listening on all interfaces (0.0.0.0). Consider using 127.0.0.1 (--binding option)
=> Ctrl-C to shutdown server
Exiting
/Users/christinating/.rvm/gems/ruby-2.1.3/bundler/gems/active_admin-48a8674a4566/lib/active_admin/application.rb:116:in `allow_comments=': `config.allow_comments` is no longer provided in ActiveAdmin 1.x. Use `config.comments` instead. (RuntimeError)
from /Users/christinating/scholarhood/config/initializers/active_admin.rb:104:in `block in <top (required)>'
from /Users/christinating/.rvm/gems/ruby-2.1.3/bundler/gems/active_admin-48a8674a4566/lib/active_admin.rb:71:in `setup'
from /Users/christinating/scholarhood/config/initializers/active_admin.rb:1:in `<top (required)>'
from /Users/christinating/.rvm/gems/ruby-2.1.3/gems/zeus-0.15.4/lib/zeus/load_tracking.rb:50:in `load'
from /Users/christinating/.rvm/gems/ruby-2.1.3/gems/zeus-0.15.4/lib/zeus/load_tracking.rb:50:in `load'
from /Users/christinating/.rvm/gems/ruby-2.1.3/gems/zeus-0.15.4/lib/zeus/load_tracking.rb:43:in `load'
from /Users/christinating/.rvm/gems/ruby-2.1.3/gems/activesupport-4.1.0/lib/active_support/dependencies.rb:241:in `block in load'
from /Users/christinating/.rvm/gems/ruby-2.1.3/gems/activesupport-4.1.0/lib/active_support/dependencies.rb:232:in `load_dependency'
from /Users/christinating/.rvm/gems/ruby-2.1.3/gems/activesupport-4.1.0/lib/active_support/dependencies.rb:241:in `load'
from /Users/christinating/.rvm/gems/ruby-2.1.3/gems/railties-4.1.0/lib/rails/engine.rb:648:in `block in load_config_initializer'
from /Users/christinating/.rvm/gems/ruby-2.1.3/gems/activesupport-4.1.0/lib/active_support/notifications.rb:161:in `instrument'
from /Users/christinating/.rvm/gems/ruby-2.1.3/gems/railties-4.1.0/lib/rails/engine.rb:647:in `load_config_initializer'
from /Users/christinating/.rvm/gems/ruby-2.1.3/gems/railties-4.1.0/lib/rails/engine.rb:612:in `block (2 levels) in <class:Engine>'
from /Users/christinating/.rvm/gems/ruby-2.1.3/gems/railties-4.1.0/lib/rails/engine.rb:611:in `each'
from /Users/christinating/.rvm/gems/ruby-2.1.3/gems/railties-4.1.0/lib/rails/engine.rb:611:in `block in <class:Engine>'
from /Users/christinating/.rvm/gems/ruby-2.1.3/gems/railties-4.1.0/lib/rails/initializable.rb:30:in `instance_exec'
from /Users/christinating/.rvm/gems/ruby-2.1.3/gems/railties-4.1.0/lib/rails/initializable.rb:30:in `run'
from /Users/christinating/.rvm/gems/ruby-2.1.3/gems/railties-4.1.0/lib/rails/initializable.rb:55:in `block in run_initializers'
from /Users/christinating/.rvm/rubies/ruby-2.1.3/lib/ruby/2.1.0/tsort.rb:226:in `block in tsort_each'
from /Users/christinating/.rvm/rubies/ruby-2.1.3/lib/ruby/2.1.0/tsort.rb:348:in `block (2 levels) in each_strongly_connected_component'
from /Users/christinating/.rvm/rubies/ruby-2.1.3/lib/ruby/2.1.0/tsort.rb:418:in `block (2 levels) in each_strongly_connected_component_from'
from /Users/christinating/.rvm/rubies/ruby-2.1.3/lib/ruby/2.1.0/tsort.rb:427:in `each_strongly_connected_component_from'
from /Users/christinating/.rvm/rubies/ruby-2.1.3/lib/ruby/2.1.0/tsort.rb:417:in `block in each_strongly_connected_component_from'
from /Users/christinating/.rvm/gems/ruby-2.1.3/gems/railties-4.1.0/lib/rails/initializable.rb:44:in `each'
from /Users/christinating/.rvm/gems/ruby-2.1.3/gems/railties-4.1.0/lib/rails/initializable.rb:44:in `tsort_each_child'
from /Users/christinating/.rvm/rubies/ruby-2.1.3/lib/ruby/2.1.0/tsort.rb:411:in `call'
from /Users/christinating/.rvm/rubies/ruby-2.1.3/lib/ruby/2.1.0/tsort.rb:411:in `each_strongly_connected_component_from'
from /Users/christinating/.rvm/rubies/ruby-2.1.3/lib/ruby/2.1.0/tsort.rb:347:in `block in each_strongly_connected_component'
from /Users/christinating/.rvm/rubies/ruby-2.1.3/lib/ruby/2.1.0/tsort.rb:345:in `each'
from /Users/christinating/.rvm/rubies/ruby-2.1.3/lib/ruby/2.1.0/tsort.rb:345:in `call'
from /Users/christinating/.rvm/rubies/ruby-2.1.3/lib/ruby/2.1.0/tsort.rb:345:in `each_strongly_connected_component'
from /Users/christinating/.rvm/rubies/ruby-2.1.3/lib/ruby/2.1.0/tsort.rb:224:in `tsort_each'
from /Users/christinating/.rvm/rubies/ruby-2.1.3/lib/ruby/2.1.0/tsort.rb:205:in `tsort_each'
from /Users/christinating/.rvm/gems/ruby-2.1.3/gems/railties-4.1.0/lib/rails/initializable.rb:54:in `run_initializers'
from /Users/christinating/.rvm/gems/ruby-2.1.3/gems/railties-4.1.0/lib/rails/application.rb:288:in `initialize!'
from /Users/christinating/.rvm/gems/ruby-2.1.3/gems/railties-4.1.0/lib/rails/railtie.rb:194:in `public_send'
from /Users/christinating/.rvm/gems/ruby-2.1.3/gems/railties-4.1.0/lib/rails/railtie.rb:194:in `method_missing'
from /Users/christinating/scholarhood/config/environment.rb:5:in `<top (required)>'
from /Users/christinating/.rvm/gems/ruby-2.1.3/gems/activesupport-4.1.0/lib/active_support/dependencies.rb:247:in `require'
from /Users/christinating/.rvm/gems/ruby-2.1.3/gems/activesupport-4.1.0/lib/active_support/dependencies.rb:247:in `block in require'
from /Users/christinating/.rvm/gems/ruby-2.1.3/gems/activesupport-4.1.0/lib/active_support/dependencies.rb:232:in `load_dependency'
from /Users/christinating/.rvm/gems/ruby-2.1.3/gems/activesupport-4.1.0/lib/active_support/dependencies.rb:247:in `require'
from /Users/christinating/scholarhood/config.ru:11:in `block in <main>'
from /Users/christinating/.rvm/gems/ruby-2.1.3/gems/rack-1.5.2/lib/rack/builder.rb:55:in `instance_eval'
from /Users/christinating/.rvm/gems/ruby-2.1.3/gems/rack-1.5.2/lib/rack/builder.rb:55:in `initialize'
from /Users/christinating/scholarhood/config.ru:in `new'
from /Users/christinating/scholarhood/config.ru:in `<main>'
from /Users/christinating/.rvm/gems/ruby-2.1.3/gems/rack-1.5.2/lib/rack/builder.rb:49:in `eval'
from /Users/christinating/.rvm/gems/ruby-2.1.3/gems/rack-1.5.2/lib/rack/builder.rb:49:in `new_from_string'
from /Users/christinating/.rvm/gems/ruby-2.1.3/gems/rack-1.5.2/lib/rack/builder.rb:40:in `parse_file'
from /Users/christinating/.rvm/gems/ruby-2.1.3/gems/rack-1.5.2/lib/rack/server.rb:277:in `build_app_and_options_from_config'
from /Users/christinating/.rvm/gems/ruby-2.1.3/gems/rack-1.5.2/lib/rack/server.rb:199:in `app'
from /Users/christinating/.rvm/gems/ruby-2.1.3/gems/railties-4.1.0/lib/rails/commands/server.rb:50:in `app'
from /Users/christinating/.rvm/gems/ruby-2.1.3/gems/rack-1.5.2/lib/rack/server.rb:314:in `wrapped_app'
from /Users/christinating/.rvm/gems/ruby-2.1.3/gems/railties-4.1.0/lib/rails/commands/server.rb:130:in `log_to_stdout'
from /Users/christinating/.rvm/gems/ruby-2.1.3/gems/railties-4.1.0/lib/rails/commands/server.rb:67:in `start'
from /Users/christinating/.rvm/gems/ruby-2.1.3/gems/railties-4.1.0/lib/rails/commands/commands_tasks.rb:81:in `block in server'
from /Users/christinating/.rvm/gems/ruby-2.1.3/gems/railties-4.1.0/lib/rails/commands/commands_tasks.rb:76:in `tap'
from /Users/christinating/.rvm/gems/ruby-2.1.3/gems/railties-4.1.0/lib/rails/commands/commands_tasks.rb:76:in `server'
from /Users/christinating/.rvm/gems/ruby-2.1.3/gems/railties-4.1.0/lib/rails/commands/commands_tasks.rb:40:in `run_command!'
from /Users/christinating/.rvm/gems/ruby-2.1.3/gems/railties-4.1.0/lib/rails/commands.rb:17:in `<top (required)>'
from bin/rails:4:in `require'
from bin/rails:4:in `<main>'
This project requires version ruby 2.1.3 to work though.
Can anyone please help me?
According to the error message:
config.allow_comments is no longer provided in ActiveAdmin 1.x. Use config.comments instead.
So, you need to edit config/initializers/active_admin.rb and change:
config.allow_comments
to:
config.comments
Rails server suddenly keeps exiting on startup. Though it worked perfectly a little while ago. I haven't tweaked anything since.
=> Booting WEBrick
=> Rails 4.0.2 application starting in development on http: //0.0.0.0:3000
=> Run `rails server -h` for more startup options
=> Ctrl-C to shutdown server
Exiting
/home/kavya/.rvm/gems/ruby-2.1.0/gems/actionpack-4.0.2/lib/action_dispatch/routing/mapper.rb:229:in `default_controller_and_action': missing :controller (ArgumentError)
from /home/kavya/.rvm/gems/ruby-2.1.0/gems/actionpack-4.0.2/lib/action_dispatch/routing/mapper.rb:116:in `normalize_options!'
from /home/kavya/.rvm/gems/ruby-2.1.0/gems/actionpack-4.0.2/lib/action_dispatch/routing/mapper.rb:64:in `initialize'
from /home/kavya/.rvm/gems/ruby-2.1.0/gems/actionpack-4.0.2/lib/action_dispatch/routing/mapper.rb:1443:in `new'
from /home/kavya/.rvm/gems/ruby-2.1.0/gems/actionpack-4.0.2/lib/action_dispatch/routing/mapper.rb:1443:in `add_route'
from /home/kavya/.rvm/gems/ruby-2.1.0/gems/actionpack-4.0.2/lib/action_dispatch/routing/mapper.rb:1422:in `decomposed_match'
from /home/kavya/.rvm/gems/ruby-2.1.0/gems/actionpack-4.0.2/lib/action_dispatch/routing/mapper.rb:1403:in `block in match'
from /home/kavya/.rvm/gems/ruby-2.1.0/gems/actionpack-4.0.2/lib/action_dispatch/routing/mapper.rb:1394:in `each'
from /home/kavya/.rvm/gems/ruby-2.1.0/gems/actionpack-4.0.2/lib/action_dispatch/routing/mapper.rb:1394:in `match'
from /home/kavya/.rvm/gems/ruby-2.1.0/gems/actionpack-4.0.2/lib/action_dispatch/routing/mapper.rb:601:in `map_method'
from /home/kavya/.rvm/gems/ruby-2.1.0/gems/actionpack-4.0.2/lib/action_dispatch/routing/mapper.rb:570:in `post'
from /home/kavya/lms/config/routes.rb:11:in `block in <top (required)>'
from /home/kavya/.rvm/gems/ruby-2.1.0/gems/actionpack-4.0.2/lib/action_dispatch/routing/route_set.rb:341:in `instance_exec'
from /home/kavya/.rvm/gems/ruby-2.1.0/gems/actionpack-4.0.2/lib/action_dispatch/routing/route_set.rb:341:in `eval_block'
from /home/kavya/.rvm/gems/ruby-2.1.0/gems/actionpack-4.0.2/lib/action_dispatch/routing/route_set.rb:319:in `draw'
from /home/kavya/lms/config/routes.rb:1:in `<top (required)>'
from /home/kavya/.rvm/gems/ruby-2.1.0/gems/activesupport-4.0.2/lib/active_support/dependencies.rb:223:in `load'
from /home/kavya/.rvm/gems/ruby-2.1.0/gems/activesupport-4.0.2/lib/active_support/dependencies.rb:223:in `block in load'
from /home/kavya/.rvm/gems/ruby-2.1.0/gems/activesupport-4.0.2/lib/active_support/dependencies.rb:214:in `load_dependency'
from /home/kavya/.rvm/gems/ruby-2.1.0/gems/activesupport-4.0.2/lib/active_support/dependencies.rb:223:in `load'
from /home/kavya/.rvm/gems/ruby-2.1.0/gems/railties-4.0.2/lib/rails/application/routes_reloader.rb:40:in `block in load_paths'
from /home/kavya/.rvm/gems/ruby-2.1.0/gems/railties-4.0.2/lib/rails/application/routes_reloader.rb:40:in `each'
from /home/kavya/.rvm/gems/ruby-2.1.0/gems/railties-4.0.2/lib/rails/application/routes_reloader.rb:40:in `load_paths'
from /home/kavya/.rvm/gems/ruby-2.1.0/gems/railties-4.0.2/lib/rails/application/routes_reloader.rb:16:in `reload!'
from /home/kavya/.rvm/gems/ruby-2.1.0/gems/railties-4.0.2/lib/rails/application/routes_reloader.rb:26:in `block in updater'
from /home/kavya/.rvm/gems/ruby-2.1.0/gems/activesupport-4.0.2/lib/active_support/file_update_checker.rb:75:in `call'
from /home/kavya/.rvm/gems/ruby-2.1.0/gems/activesupport-4.0.2/lib/active_support/file_update_checker.rb:75:in `execute'
from /home/kavya/.rvm/gems/ruby-2.1.0/gems/railties-4.0.2/lib/rails/application/routes_reloader.rb:27:in `updater'
from /home/kavya/.rvm/gems/ruby-2.1.0/gems/railties-4.0.2/lib/rails/application/routes_reloader.rb:6:in `execute_if_updated'
from /home/kavya/.rvm/gems/ruby-2.1.0/gems/railties-4.0.2/lib/rails/application/finisher.rb:69:in `block in <module:Finisher>'
from /home/kavya/.rvm/gems/ruby-2.1.0/gems/railties-4.0.2/lib/rails/initializable.rb:30:in `instance_exec'
from /home/kavya/.rvm/gems/ruby-2.1.0/gems/railties-4.0.2/lib/rails/initializable.rb:30:in `run'
from /home/kavya/.rvm/gems/ruby-2.1.0/gems/railties-4.0.2/lib/rails/initializable.rb:55:in `block in run_initializers'
from /home/kavya/.rvm/rubies/ruby-2.1.0/lib/ruby/2.1.0/tsort.rb:226:in `block in tsort_each'
from /home/kavya/.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/kavya/.rvm/rubies/ruby-2.1.0/lib/ruby/2.1.0/tsort.rb:427:in `each_strongly_connected_component_from'
from /home/kavya/.rvm/rubies/ruby-2.1.0/lib/ruby/2.1.0/tsort.rb:347:in `block in each_strongly_connected_component'
from /home/kavya/.rvm/rubies/ruby-2.1.0/lib/ruby/2.1.0/tsort.rb:345:in `each'
from /home/kavya/.rvm/rubies/ruby-2.1.0/lib/ruby/2.1.0/tsort.rb:345:in `call'
from /home/kavya/.rvm/rubies/ruby-2.1.0/lib/ruby/2.1.0/tsort.rb:345:in `each_strongly_connected_component'
from /home/kavya/.rvm/rubies/ruby-2.1.0/lib/ruby/2.1.0/tsort.rb:224:in `tsort_each'
from /home/kavya/.rvm/rubies/ruby-2.1.0/lib/ruby/2.1.0/tsort.rb:205:in `tsort_each'
from /home/kavya/.rvm/gems/ruby-2.1.0/gems/railties-4.0.2/lib/rails/initializable.rb:54:in `run_initializers'
from /home/kavya/.rvm/gems/ruby-2.1.0/gems/railties-4.0.2/lib/rails/application.rb:215:in `initialize!'
from /home/kavya/.rvm/gems/ruby-2.1.0/gems/railties-4.0.2/lib/rails/railtie/configurable.rb:30:in `method_missing'
from /home/kavya/lms/config/environment.rb:5:in `<top (required)>'
from /home/kavya/lms/config.ru:3:in `require'
from /home/kavya/lms/config.ru:3:in `block in <main>'
from /home/kavya/.rvm/gems/ruby-2.1.0/gems/rack-1.5.2/lib/rack/builder.rb:55:in `instance_eval'
from /home/kavya/.rvm/gems/ruby-2.1.0/gems/rack-1.5.2/lib/rack/builder.rb:55:in `initialize'
from /home/kavya/lms/config.ru:in `new'
from /home/kavya/lms/config.ru:in `<main>'
from /home/kavya/.rvm/gems/ruby-2.1.0/gems/rack-1.5.2/lib/rack/builder.rb:49:in `eval'
from /home/kavya/.rvm/gems/ruby-2.1.0/gems/rack-1.5.2/lib/rack/builder.rb:49:in `new_from_string'
from /home/kavya/.rvm/gems/ruby-2.1.0/gems/rack-1.5.2/lib/rack/builder.rb:40:in `parse_file'
from /home/kavya/.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/kavya/.rvm/gems/ruby-2.1.0/gems/rack-1.5.2/lib/rack/server.rb:199:in `app'
from /home/kavya/.rvm/gems/ruby-2.1.0/gems/railties-4.0.2/lib/rails/commands/server.rb:48:in `app'
from /home/kavya/.rvm/gems/ruby-2.1.0/gems/rack-1.5.2/lib/rack/server.rb:314:in `wrapped_app'
from /home/kavya/.rvm/gems/ruby-2.1.0/gems/railties-4.0.2/lib/rails/commands/server.rb:75:in `start'
from /home/kavya/.rvm/gems/ruby-2.1.0/gems/railties-4.0.2/lib/rails/commands.rb:76:in `block in <top (required)>'
from /home/kavya/.rvm/gems/ruby-2.1.0/gems/railties-4.0.2/lib/rails/commands.rb:71:in `tap'
from /home/kavya/.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>'
As you can refer here..
Why is my development server not loading? default_controller_and_action': missing :action (ArgumentError)
It's because of syntax problem under config/routes.rb in your application:
Check your routes you may find like for example while defining controller#action in routes like below..
Syntax should not be like:
root :to => 'home/index'
Syntax should be like:
root :to => 'home#index'
Here is what I get when I run rake routes:
rake aborted!
missing :controller
/usr/local/rvm/gems/ruby-1.9.3-p194/gems/actionpack-4.0.0/lib/action_dispatch/routing/mapper.rb:229:in `default_controller_and_action'
/usr/local/rvm/gems/ruby-1.9.3-p194/gems/actionpack-4.0.0/lib/action_dispatch/routing/mapper.rb:116:in `normalize_options!'
/usr/local/rvm/gems/ruby-1.9.3-p194/gems/actionpack-4.0.0/lib/action_dispatch/routing/mapper.rb:64:in `initialize'
/usr/local/rvm/gems/ruby-1.9.3-p194/gems/actionpack-4.0.0/lib/action_dispatch/routing/mapper.rb:1438:in `new'
/usr/local/rvm/gems/ruby-1.9.3-p194/gems/actionpack-4.0.0/lib/action_dispatch/routing/mapper.rb:1438:in `add_route'
/usr/local/rvm/gems/ruby-1.9.3-p194/gems/actionpack-4.0.0/lib/action_dispatch/routing/mapper.rb:1417:in `decomposed_match'
/usr/local/rvm/gems/ruby-1.9.3-p194/gems/actionpack-4.0.0/lib/action_dispatch/routing/mapper.rb:1398:in `block in match'
/usr/local/rvm/gems/ruby-1.9.3-p194/gems/actionpack-4.0.0/lib/action_dispatch/routing/mapper.rb:1389:in `each'
/usr/local/rvm/gems/ruby-1.9.3-p194/gems/actionpack-4.0.0/lib/action_dispatch/routing/mapper.rb:1389:in `match'
/usr/local/rvm/gems/ruby-1.9.3-p194/gems/actionpack-4.0.0/lib/action_dispatch/routing/mapper.rb:596:in `map_method'
/usr/local/rvm/gems/ruby-1.9.3-p194/gems/actionpack-4.0.0/lib/action_dispatch/routing/mapper.rb:557:in `get'
/Users/mlegacy/Documents/RubyProjects/relaunchradio/config/routes.rb:5:in `block in <top (required)>'
/usr/local/rvm/gems/ruby-1.9.3-p194/gems/actionpack-4.0.0/lib/action_dispatch/routing/route_set.rb:316:in `instance_exec'
/usr/local/rvm/gems/ruby-1.9.3-p194/gems/actionpack-4.0.0/lib/action_dispatch/routing/route_set.rb:316:in `eval_block'
/usr/local/rvm/gems/ruby-1.9.3-p194/gems/actionpack-4.0.0/lib/action_dispatch/routing/route_set.rb:294:in `draw'
/Users/mlegacy/Documents/RubyProjects/relaunchradio/config/routes.rb:1:in `<top (required)>'
/usr/local/rvm/gems/ruby-1.9.3-p194/gems/activesupport-4.0.0/lib/active_support/dependencies.rb:222:in `load'
/usr/local/rvm/gems/ruby-1.9.3-p194/gems/activesupport-4.0.0/lib/active_support/dependencies.rb:222:in `block in load'
/usr/local/rvm/gems/ruby-1.9.3-p194/gems/activesupport-4.0.0/lib/active_support/dependencies.rb:213:in `load_dependency'
/usr/local/rvm/gems/ruby-1.9.3-p194/gems/activesupport-4.0.0/lib/active_support/dependencies.rb:222:in `load'
/usr/local/rvm/gems/ruby-1.9.3-p194/gems/railties-4.0.0/lib/rails/application/routes_reloader.rb:40:in `block in load_paths'
/usr/local/rvm/gems/ruby-1.9.3-p194/gems/railties-4.0.0/lib/rails/application/routes_reloader.rb:40:in `each'
/usr/local/rvm/gems/ruby-1.9.3-p194/gems/railties-4.0.0/lib/rails/application/routes_reloader.rb:40:in `load_paths'
/usr/local/rvm/gems/ruby-1.9.3-p194/gems/railties-4.0.0/lib/rails/application/routes_reloader.rb:16:in `reload!'
/usr/local/rvm/gems/ruby-1.9.3-p194/gems/railties-4.0.0/lib/rails/application/routes_reloader.rb:26:in `block in updater'
/usr/local/rvm/gems/ruby-1.9.3-p194/gems/activesupport-4.0.0/lib/active_support/file_update_checker.rb:75:in `call'
/usr/local/rvm/gems/ruby-1.9.3-p194/gems/activesupport-4.0.0/lib/active_support/file_update_checker.rb:75:in `execute'
/usr/local/rvm/gems/ruby-1.9.3-p194/gems/railties-4.0.0/lib/rails/application/routes_reloader.rb:27:in `updater'
/usr/local/rvm/gems/ruby-1.9.3-p194/gems/railties-4.0.0/lib/rails/application/routes_reloader.rb:6:in `execute_if_updated'
/usr/local/rvm/gems/ruby-1.9.3-p194/gems/railties-4.0.0/lib/rails/application/finisher.rb:69:in `block in <module:Finisher>'
/usr/local/rvm/gems/ruby-1.9.3-p194/gems/railties-4.0.0/lib/rails/initializable.rb:30:in `instance_exec'
/usr/local/rvm/gems/ruby-1.9.3-p194/gems/railties-4.0.0/lib/rails/initializable.rb:30:in `run'
/usr/local/rvm/gems/ruby-1.9.3-p194/gems/railties-4.0.0/lib/rails/initializable.rb:55:in `block in run_initializers'
/usr/local/rvm/gems/ruby-1.9.3-p194/gems/railties-4.0.0/lib/rails/initializable.rb:54:in `run_initializers'
/usr/local/rvm/gems/ruby-1.9.3-p194/gems/railties-4.0.0/lib/rails/application.rb:215:in `initialize!'
/usr/local/rvm/gems/ruby-1.9.3-p194/gems/railties-4.0.0/lib/rails/railtie/configurable.rb:30:in `method_missing'
/Users/mlegacy/Documents/RubyProjects/relaunchradio/config/environment.rb:5:in `<top (required)>'
/usr/local/rvm/gems/ruby-1.9.3-p194/gems/activesupport-4.0.0/lib/active_support/dependencies.rb:228:in `require'
/usr/local/rvm/gems/ruby-1.9.3-p194/gems/activesupport-4.0.0/lib/active_support/dependencies.rb:228:in `block in require'
/usr/local/rvm/gems/ruby-1.9.3-p194/gems/activesupport-4.0.0/lib/active_support/dependencies.rb:213:in `load_dependency'
/usr/local/rvm/gems/ruby-1.9.3-p194/gems/activesupport-4.0.0/lib/active_support/dependencies.rb:228:in `require'
/usr/local/rvm/gems/ruby-1.9.3-p194/gems/railties-4.0.0/lib/rails/application.rb:189:in `require_environment!'
/usr/local/rvm/gems/ruby-1.9.3-p194/gems/railties-4.0.0/lib/rails/application.rb:249:in `block in run_tasks_blocks'
Tasks: TOP => routes => environment
(See full trace by running task with --trace)
Here is my routes file:
Blog::Application.routes.draw do
root to: 'home#index2'
get "sessions#new"
resources :users
get "pitchme", to: "pitchme#index", as: "pitchme"
get "gregg", to: "gregg#index", as: "gregg"
get "webleads", to: "webleads#index", as: "webleads"
get "connect", to: "connect#index", as: "connect"
get "home", to: "home#index", as: "home"
mount Ckeditor::Engine => '/ckeditor'
get "posts#new"
resources :posts
get 'signup', to: 'users#new', as: 'signup'
get 'login', to: 'sessions#new', as: 'login'
get 'logout', to: 'sessions#destroy', as: 'logout'
resources :users
resources :sessions
end
I can't find an error in my routes...I really have no idea what's going one.
I generated a controller with actions that had dashes in their names, and i found out that is a problem, but I deleted those pages and controller and it's still screwed up. This is so frustrating.
Just for fun, here is my trace for rails s:
=> Booting WEBrick
=> Rails 4.0.0 application starting in development on http://0.0.0.0:3000
=> Run `rails server -h` for more startup options
=> Ctrl-C to shutdown server
Exiting
/usr/local/rvm/gems/ruby-1.9.3-p194/gems/actionpack- 4.0.0/lib/action_dispatch/routing/mapper.rb:229:in `default_controller_and_action': missing :controller (ArgumentError)
from /usr/local/rvm/gems/ruby-1.9.3-p194/gems/actionpack-4.0.0/lib/action_dispatch/routing/mapper.rb:116:in `normalize_options!'
from /usr/local/rvm/gems/ruby-1.9.3-p194/gems/actionpack-4.0.0/lib/action_dispatch/routing/mapper.rb:64:in `initialize'
from /usr/local/rvm/gems/ruby-1.9.3-p194/gems/actionpack-4.0.0/lib/action_dispatch/routing/mapper.rb:1438:in `new'
from /usr/local/rvm/gems/ruby-1.9.3-p194/gems/actionpack-4.0.0/lib/action_dispatch/routing/mapper.rb:1438:in `add_route'
from /usr/local/rvm/gems/ruby-1.9.3-p194/gems/actionpack-4.0.0/lib/action_dispatch/routing/mapper.rb:1417:in `decomposed_match'
from /usr/local/rvm/gems/ruby-1.9.3-p194/gems/actionpack-4.0.0/lib/action_dispatch/routing/mapper.rb:1398:in `block in match'
from /usr/local/rvm/gems/ruby-1.9.3-p194/gems/actionpack-4.0.0/lib/action_dispatch/routing/mapper.rb:1389:in `each'
from /usr/local/rvm/gems/ruby-1.9.3-p194/gems/actionpack-4.0.0/lib/action_dispatch/routing/mapper.rb:1389:in `match'
from /usr/local/rvm/gems/ruby-1.9.3-p194/gems/actionpack-4.0.0/lib/action_dispatch/routing/mapper.rb:596:in `map_method'
from /usr/local/rvm/gems/ruby-1.9.3-p194/gems/actionpack-4.0.0/lib/action_dispatch/routing/mapper.rb:557:in `get'
from /Users/mlegacy/Documents/RubyProjects/relaunchradio/config/routes.rb:5:in `block in <top (required)>'
from /usr/local/rvm/gems/ruby-1.9.3-p194/gems/actionpack-4.0.0/lib/action_dispatch/routing/route_set.rb:316:in `instance_exec'
from /usr/local/rvm/gems/ruby-1.9.3-p194/gems/actionpack-4.0.0/lib/action_dispatch/routing/route_set.rb:316:in `eval_block'
from /usr/local/rvm/gems/ruby-1.9.3-p194/gems/actionpack-4.0.0/lib/action_dispatch/routing/route_set.rb:294:in `draw'
from /Users/mlegacy/Documents/RubyProjects/relaunchradio/config/routes.rb:1:in `<top (required)>'
from /usr/local/rvm/gems/ruby-1.9.3-p194/gems/activesupport-4.0.0/lib/active_support/dependencies.rb:222:in `load'
from /usr/local/rvm/gems/ruby-1.9.3-p194/gems/activesupport-4.0.0/lib/active_support/dependencies.rb:222:in `block in load'
from /usr/local/rvm/gems/ruby-1.9.3-p194/gems/activesupport-4.0.0/lib/active_support/dependencies.rb:213:in `load_dependency'
from /usr/local/rvm/gems/ruby-1.9.3-p194/gems/activesupport-4.0.0/lib/active_support/dependencies.rb:222:in `load'
from /usr/local/rvm/gems/ruby-1.9.3-p194/gems/railties-4.0.0/lib/rails/application/routes_reloader.rb:40:in `block in load_paths'
from /usr/local/rvm/gems/ruby-1.9.3-p194/gems/railties-4.0.0/lib/rails/application/routes_reloader.rb:40:in `each'
from /usr/local/rvm/gems/ruby-1.9.3-p194/gems/railties-4.0.0/lib/rails/application/routes_reloader.rb:40:in `load_paths'
from /usr/local/rvm/gems/ruby-1.9.3-p194/gems/railties-4.0.0/lib/rails/application/routes_reloader.rb:16:in `reload!'
from /usr/local/rvm/gems/ruby-1.9.3-p194/gems/railties-4.0.0/lib/rails/application/routes_reloader.rb:26:in `block in updater'
from /usr/local/rvm/gems/ruby-1.9.3-p194/gems/activesupport-4.0.0/lib/active_support/file_update_checker.rb:75:in `call'
from /usr/local/rvm/gems/ruby-1.9.3-p194/gems/activesupport-4.0.0/lib/active_support/file_update_checker.rb:75:in `execute'
from /usr/local/rvm/gems/ruby-1.9.3-p194/gems/railties-4.0.0/lib/rails/application/routes_reloader.rb:27:in `updater'
from /usr/local/rvm/gems/ruby-1.9.3-p194/gems/railties-4.0.0/lib/rails/application/routes_reloader.rb:6:in `execute_if_updated'
from /usr/local/rvm/gems/ruby-1.9.3-p194/gems/railties-4.0.0/lib/rails/application/finisher.rb:69:in `block in <module:Finisher>'
from /usr/local/rvm/gems/ruby-1.9.3-p194/gems/railties-4.0.0/lib/rails/initializable.rb:30:in `instance_exec'
from /usr/local/rvm/gems/ruby-1.9.3-p194/gems/railties-4.0.0/lib/rails/initializable.rb:30:in `run'
from /usr/local/rvm/gems/ruby-1.9.3-p194/gems/railties-4.0.0/lib/rails/initializable.rb:55:in `block in run_initializers'
from /usr/local/rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/tsort.rb:150:in `block in tsort_each'
from /usr/local/rvm/rubies/ruby-1.9.3-p194/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-p194/lib/ruby/1.9.1/tsort.rb:219:in `each_strongly_connected_component_from'
from /usr/local/rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/tsort.rb:182:in `block in each_strongly_connected_component'
from /usr/local/rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/tsort.rb:180:in `each'
from /usr/local/rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/tsort.rb:180:in `each_strongly_connected_component'
from /usr/local/rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/tsort.rb:148:in `tsort_each'
from /usr/local/rvm/gems/ruby-1.9.3-p194/gems/railties-4.0.0/lib/rails/initializable.rb:54:in `run_initializers'
from /usr/local/rvm/gems/ruby-1.9.3-p194/gems/railties-4.0.0/lib/rails/application.rb:215:in `initialize!'
from /usr/local/rvm/gems/ruby-1.9.3-p194/gems/railties-4.0.0/lib/rails/railtie/configurable.rb:30:in `method_missing'
from /Users/mlegacy/Documents/RubyProjects/relaunchradio/config/environment.rb:5:in `<top (required)>'
from /Users/mlegacy/Documents/RubyProjects/relaunchradio/config.ru:3:in `require'
from /Users/mlegacy/Documents/RubyProjects/relaunchradio/config.ru:3:in `block in <main>'
from /usr/local/rvm/gems/ruby-1.9.3-p194/gems/rack-1.5.2/lib/rack/builder.rb:55:in `instance_eval'
from /usr/local/rvm/gems/ruby-1.9.3-p194/gems/rack-1.5.2/lib/rack/builder.rb:55:in `initialize'
from /Users/mlegacy/Documents/RubyProjects/relaunchradio/config.ru:in `new'
from /Users/mlegacy/Documents/RubyProjects/relaunchradio/config.ru:in `<main>'
from /usr/local/rvm/gems/ruby-1.9.3-p194/gems/rack-1.5.2/lib/rack/builder.rb:49:in `eval'
from /usr/local/rvm/gems/ruby-1.9.3-p194/gems/rack-1.5.2/lib/rack/builder.rb:49:in `new_from_string'
from /usr/local/rvm/gems/ruby-1.9.3-p194/gems/rack-1.5.2/lib/rack/builder.rb:40:in `parse_file'
from /usr/local/rvm/gems/ruby-1.9.3-p194/gems/rack-1.5.2/lib/rack/server.rb:277:in `build_app_and_options_from_config'
from /usr/local/rvm/gems/ruby-1.9.3-p194/gems/rack-1.5.2/lib/rack/server.rb:199:in `app'
from /usr/local/rvm/gems/ruby-1.9.3-p194/gems/railties-4.0.0/lib/rails/commands/server.rb:48:in `app'
from /usr/local/rvm/gems/ruby-1.9.3-p194/gems/rack-1.5.2/lib/rack/server.rb:314:in `wrapped_app'
from /usr/local/rvm/gems/ruby-1.9.3-p194/gems/railties-4.0.0/lib/rails/commands/server.rb:75:in `start'
from /usr/local/rvm/gems/ruby-1.9.3-p194/gems/railties-4.0.0/lib/rails/commands.rb:78:in `block in <top (required)>'
from /usr/local/rvm/gems/ruby-1.9.3-p194/gems/railties-4.0.0/lib/rails/commands.rb:73:in `tap'
from /usr/local/rvm/gems/ruby-1.9.3-p194/gems/railties-4.0.0/lib/rails/commands.rb:73:in `<top (required)>'
from bin/rails:4:in `require'
from bin/rails:4:in `<main>'
The argument error it's pointing to is:
if controller.blank? && segment_keys.exclude?(:controller)
raise ArgumentError, "missing :controller"
end
But I don't have any blank controllers....
The problem WAS the routes.
It was these two:
get 'sessions#new'
get 'posts#new'
They have to be:
get 'sessions/new'
get 'posts/new'
That was annoying. Hopefully this helps you.
I am new to ruby on rails, I am getting following error after starting rails server 'rails server'
> Booting WEBrick
=> Rails 4.0.0 application starting in development on ://0.0.0.0:3000
=> Run `rails server -h` for more startup options
=> Ctrl-C to shutdown server
Exiting
/home/mahipal/.rvm/gems/ruby-1.9.3-p448/gems/actionpack-4.0.0/lib/action_dispatch/routing/mapper.rb:233:in `default_controller_and_action': missing :action (ArgumentError)
from /home/mahipal/.rvm/gems/ruby-1.9.3-p448/gems/actionpack-4.0.0/lib/action_dispatch/routing/mapper.rb:116:in `normalize_options!'
from /home/mahipal/.rvm/gems/ruby-1.9.3-p448/gems/actionpack-4.0.0/lib/action_dispatch/routing/mapper.rb:64:in `initialize'
from /home/mahipal/.rvm/gems/ruby-1.9.3-p448/gems/actionpack-4.0.0/lib/action_dispatch/routing/mapper.rb:1438:in `new'
from /home/mahipal/.rvm/gems/ruby-1.9.3-p448/gems/actionpack-4.0.0/lib/action_dispatch/routing/mapper.rb:1438:in `add_route'
from /home/mahipal/.rvm/gems/ruby-1.9.3-p448/gems/actionpack-4.0.0/lib/action_dispatch/routing/mapper.rb:1417:in `decomposed_match'
from /home/mahipal/.rvm/gems/ruby-1.9.3-p448/gems/actionpack-4.0.0/lib/action_dispatch/routing/mapper.rb:1398:in `block in match'
from /home/mahipal/.rvm/gems/ruby-1.9.3-p448/gems/actionpack-4.0.0/lib/action_dispatch/routing/mapper.rb:1389:in `each'
from /home/mahipal/.rvm/gems/ruby-1.9.3-p448/gems/actionpack-4.0.0/lib/action_dispatch/routing/mapper.rb:1389:in `match'
from /home/mahipal/.rvm/gems/ruby-1.9.3-p448/gems/actionpack-4.0.0/lib/action_dispatch/routing/mapper.rb:330:in `root'
from /home/mahipal/.rvm/gems/ruby-1.9.3-p448/gems/actionpack-4.0.0/lib/action_dispatch/routing/mapper.rb:1459:in `root'
from /home/mahipal/rails_projects/sample_app/config/routes.rb:3:in `block in <top (required)>'
from /home/mahipal/.rvm/gems/ruby-1.9.3-p448/gems/actionpack-4.0.0/lib/action_dispatch/routing/route_set.rb:316:in `instance_exec'
from /home/mahipal/.rvm/gems/ruby-1.9.3-p448/gems/actionpack-4.0.0/lib/action_dispatch/routing/route_set.rb:316:in `eval_block'
from /home/mahipal/.rvm/gems/ruby-1.9.3-p448/gems/actionpack-4.0.0/lib/action_dispatch/routing/route_set.rb:294:in `draw'
from /home/mahipal/rails_projects/sample_app/config/routes.rb:1:in `<top (required)>'
from /home/mahipal/.rvm/gems/ruby-1.9.3-p448/gems/activesupport-4.0.0/lib/active_support/dependencies.rb:222:in `load'
from /home/mahipal/.rvm/gems/ruby-1.9.3-p448/gems/activesupport-4.0.0/lib/active_support/dependencies.rb:222:in `block in load'
from /home/mahipal/.rvm/gems/ruby-1.9.3-p448/gems/activesupport-4.0.0/lib/active_support/dependencies.rb:213:in `load_dependency'
from /home/mahipal/.rvm/gems/ruby-1.9.3-p448/gems/activesupport-4.0.0/lib/active_support/dependencies.rb:222:in `load'
from /home/mahipal/.rvm/gems/ruby-1.9.3-p448/gems/railties-4.0.0/lib/rails/application/routes_reloader.rb:40:in `block in load_paths'
from /home/mahipal/.rvm/gems/ruby-1.9.3-p448/gems/railties-4.0.0/lib/rails/application/routes_reloader.rb:40:in `each'
from /home/mahipal/.rvm/gems/ruby-1.9.3-p448/gems/railties-4.0.0/lib/rails/application/routes_reloader.rb:40:in `load_paths'
from /home/mahipal/.rvm/gems/ruby-1.9.3-p448/gems/railties-4.0.0/lib/rails/application/routes_reloader.rb:16:in `reload!'
from /home/mahipal/.rvm/gems/ruby-1.9.3-p448/gems/railties-4.0.0/lib/rails/application/routes_reloader.rb:26:in `block in updater'
from /home/mahipal/.rvm/gems/ruby-1.9.3-p448/gems/activesupport-4.0.0/lib/active_support/file_update_checker.rb:75:in `call'
from /home/mahipal/.rvm/gems/ruby-1.9.3-p448/gems/activesupport-4.0.0/lib/active_support/file_update_checker.rb:75:in `execute'
from /home/mahipal/.rvm/gems/ruby-1.9.3-p448/gems/railties-4.0.0/lib/rails/application/routes_reloader.rb:27:in `updater'
from /home/mahipal/.rvm/gems/ruby-1.9.3-p448/gems/railties-4.0.0/lib/rails/application/routes_reloader.rb:6:in `execute_if_updated'
from /home/mahipal/.rvm/gems/ruby-1.9.3-p448/gems/railties-4.0.0/lib/rails/application/finisher.rb:69:in `block in <module:Finisher>'
from /home/mahipal/.rvm/gems/ruby-1.9.3-p448/gems/railties-4.0.0/lib/rails/initializable.rb:30:in `instance_exec'
from /home/mahipal/.rvm/gems/ruby-1.9.3-p448/gems/railties-4.0.0/lib/rails/initializable.rb:30:in `run'
from /home/mahipal/.rvm/gems/ruby-1.9.3-p448/gems/railties-4.0.0/lib/rails/initializable.rb:55:in `block in run_initializers'
from /home/mahipal/.rvm/rubies/ruby-1.9.3-p448/lib/ruby/1.9.1/tsort.rb:150:in `block in tsort_each'
from /home/mahipal/.rvm/rubies/ruby-1.9.3-p448/lib/ruby/1.9.1/tsort.rb:183:in `block (2 levels) in each_strongly_connected_component'
from /home/mahipal/.rvm/rubies/ruby-1.9.3-p448/lib/ruby/1.9.1/tsort.rb:219:in `each_strongly_connected_component_from'
from /home/mahipal/.rvm/rubies/ruby-1.9.3-p448/lib/ruby/1.9.1/tsort.rb:182:in `block in each_strongly_connected_component'
from /home/mahipal/.rvm/rubies/ruby-1.9.3-p448/lib/ruby/1.9.1/tsort.rb:180:in `each'
from /home/mahipal/.rvm/rubies/ruby-1.9.3-p448/lib/ruby/1.9.1/tsort.rb:180:in `each_strongly_connected_component'
from /home/mahipal/.rvm/rubies/ruby-1.9.3-p448/lib/ruby/1.9.1/tsort.rb:148:in `tsort_each'
from /home/mahipal/.rvm/gems/ruby-1.9.3-p448/gems/railties-4.0.0/lib/rails/initializable.rb:54:in `run_initializers'
from /home/mahipal/.rvm/gems/ruby-1.9.3-p448/gems/railties-4.0.0/lib/rails/application.rb:215:in `initialize!'
from /home/mahipal/.rvm/gems/ruby-1.9.3-p448/gems/railties-4.0.0/lib/rails/railtie/configurable.rb:30:in `method_missing'
from /home/mahipal/rails_projects/sample_app/config/environment.rb:5:in `<top (required)>'
from /home/mahipal/rails_projects/sample_app/config.ru:3:in `require'
from /home/mahipal/rails_projects/sample_app/config.ru:3:in `block in <main>'
from /home/mahipal/.rvm/gems/ruby-1.9.3-p448/gems/rack-1.5.2/lib/rack/builder.rb:55:in `instance_eval'
from /home/mahipal/.rvm/gems/ruby-1.9.3-p448/gems/rack-1.5.2/lib/rack/builder.rb:55:in `initialize'
from /home/mahipal/rails_projects/sample_app/config.ru:in `new'
from /home/mahipal/rails_projects/sample_app/config.ru:in `<main>'
from /home/mahipal/.rvm/gems/ruby-1.9.3-p448/gems/rack-1.5.2/lib/rack/builder.rb:49:in `eval'
from /home/mahipal/.rvm/gems/ruby-1.9.3-p448/gems/rack-1.5.2/lib/rack/builder.rb:49:in `new_from_string'
from /home/mahipal/.rvm/gems/ruby-1.9.3-p448/gems/rack-1.5.2/lib/rack/builder.rb:40:in `parse_file'
from /home/mahipal/.rvm/gems/ruby-1.9.3-p448/gems/rack-1.5.2/lib/rack/server.rb:277:in `build_app_and_options_from_config'
from /home/mahipal/.rvm/gems/ruby-1.9.3-p448/gems/rack-1.5.2/lib/rack/server.rb:199:in `app'
from /home/mahipal/.rvm/gems/ruby-1.9.3-p448/gems/railties-4.0.0/lib/rails/commands/server.rb:48:in `app'
from /home/mahipal/.rvm/gems/ruby-1.9.3-p448/gems/rack-1.5.2/lib/rack/server.rb:314:in `wrapped_app'
from /home/mahipal/.rvm/gems/ruby-1.9.3-p448/gems/railties-4.0.0/lib/rails/commands/server.rb:75:in `start'
from /home/mahipal/.rvm/gems/ruby-1.9.3-p448/gems/railties-4.0.0/lib/rails/commands.rb:78:in `block in <top (required)>'
from /home/mahipal/.rvm/gems/ruby-1.9.3-p448/gems/railties-4.0.0/lib/rails/commands.rb:73:in `tap'
from /home/mahipal/.rvm/gems/ruby-1.9.3-p448/gems/railties-4.0.0/lib/rails/commands.rb:73:in `<top (required)>'
from bin/rails:4:in `require'
from bin/rails:4:in `<main>'
Take care with the spaces in the Routes.
get '/way' , to: 'controller#action' #one space Ok
get '/way' , to: 'controller#action' # two spaces Erro
I'am working on "How to Create a Blog from Scratch Using Ruby on Rails" from http://sixrevisions.com. The tutorial was created for Rails 2.x. I try to get It working on Rails 3.x. . When I run server I and run localhost:3000 get some serious routing error:
Called from: C:/Ruby193/lib/ruby/gems/1.9.1/gems/actionpack-3.2.6/lib/ac
tion_dispatch/middleware/session/abstract_store.rb:28:in `initialize'.
Exiting
C:/Ruby193/lib/ruby/gems/1.9.1/gems/actionpack-3.2.6/lib/action_dispatch/routing
/mapper.rb:185:in `default_controller_and_action': missing :action (ArgumentError)
from C:/Ruby193/lib/ruby/gems/1.9.1/gems/actionpack-3.2.6/lib/action_dis
patch/routing/mapper.rb:78:in `normalize_options!'
from C:/Ruby193/lib/ruby/gems/1.9.1/gems/actionpack-3.2.6/lib/action_dis
patch/routing/mapper.rb:61:in `initialize'
from C:/Ruby193/lib/ruby/gems/1.9.1/gems/actionpack-3.2.6/lib/action_dis
patch/routing/mapper.rb:1304:in `new'
from C:/Ruby193/lib/ruby/gems/1.9.1/gems/actionpack-3.2.6/lib/action_dis
patch/routing/mapper.rb:1304:in `add_route'
from C:/Ruby193/lib/ruby/gems/1.9.1/gems/actionpack-3.2.6/lib/action_dis
patch/routing/mapper.rb:1284:in `decomposed_match'
from C:/Ruby193/lib/ruby/gems/1.9.1/gems/actionpack-3.2.6/lib/action_dis
patch/routing/mapper.rb:1270:in `block in match'
from C:/Ruby193/lib/ruby/gems/1.9.1/gems/actionpack-3.2.6/lib/action_dis
patch/routing/mapper.rb:1270:in `each'
from C:/Ruby193/lib/ruby/gems/1.9.1/gems/actionpack-3.2.6/lib/action_dis
patch/routing/mapper.rb:1270:in `match'
from C:/Ruby193/lib/ruby/gems/1.9.1/gems/actionpack-3.2.6/lib/action_dis
patch/routing/mapper.rb:260:in `root'
from C:/Ruby193/lib/ruby/gems/1.9.1/gems/actionpack-3.2.6/lib/action_dis
patch/routing/mapper.rb:1317:in `root'
from D:/myblog/config/routes.rb:5:in `block in <top (required)>'
from C:/Ruby193/lib/ruby/gems/1.9.1/gems/actionpack-3.2.6/lib/action_dis
patch/routing/route_set.rb:282:in `instance_exec'
from C:/Ruby193/lib/ruby/gems/1.9.1/gems/actionpack-3.2.6/lib/action_dis
patch/routing/route_set.rb:282:in `eval_block'
from C:/Ruby193/lib/ruby/gems/1.9.1/gems/actionpack-3.2.6/lib/action_dis
patch/routing/route_set.rb:260:in `draw'
from D:/myblog/config/routes.rb:1:in `<top (required)>'
from C:/Ruby193/lib/ruby/gems/1.9.1/gems/activesupport-3.2.6/lib/active_
support/dependencies.rb:245:in `load'
from C:/Ruby193/lib/ruby/gems/1.9.1/gems/activesupport-3.2.6/lib/active_
support/dependencies.rb:245:in `block in load'
from C:/Ruby193/lib/ruby/gems/1.9.1/gems/activesupport-3.2.6/lib/active_
support/dependencies.rb:236:in `load_dependency'
from C:/Ruby193/lib/ruby/gems/1.9.1/gems/activesupport-3.2.6/lib/active_
support/dependencies.rb:245:in `load'
from C:/Ruby193/lib/ruby/gems/1.9.1/gems/railties-3.2.6/lib/rails/applic
ation/routes_reloader.rb:40:in `block in load_paths'
from C:/Ruby193/lib/ruby/gems/1.9.1/gems/railties-3.2.6/lib/rails/applic
ation/routes_reloader.rb:40:in `each'
from C:/Ruby193/lib/ruby/gems/1.9.1/gems/railties-3.2.6/lib/rails/applic
ation/routes_reloader.rb:40:in `load_paths'
from C:/Ruby193/lib/ruby/gems/1.9.1/gems/railties-3.2.6/lib/rails/applic
ation/routes_reloader.rb:16:in `reload!'
from C:/Ruby193/lib/ruby/gems/1.9.1/gems/railties-3.2.6/lib/rails/applic
ation/routes_reloader.rb:26:in `block in updater'
from C:/Ruby193/lib/ruby/gems/1.9.1/gems/activesupport-3.2.6/lib/active_
support/file_update_checker.rb:78:in `call'
from C:/Ruby193/lib/ruby/gems/1.9.1/gems/activesupport-3.2.6/lib/active_
support/file_update_checker.rb:78:in `execute'
from C:/Ruby193/lib/ruby/gems/1.9.1/gems/railties-3.2.6/lib/rails/applic
ation/routes_reloader.rb:27:in `updater'
from C:in `execute_if_updated'
from C:/Ruby193/lib/ruby/gems/1.9.1/gems/railties-3.2.6/lib/rails/applic
ation/finisher.rb:66:in `block in <module:Finisher>'
from C:/Ruby193/lib/ruby/gems/1.9.1/gems/railties-3.2.6/lib/rails/initia
lizable.rb:30:in `instance_exec'
from C:/Ruby193/lib/ruby/gems/1.9.1/gems/railties-3.2.6/lib/rails/initia
lizable.rb:30:in `run'
from C:/Ruby193/lib/ruby/gems/1.9.1/gems/railties-3.2.6/lib/rails/initia
lizable.rb:55:in `block in run_initializers'
from C:/Ruby193/lib/ruby/gems/1.9.1/gems/railties-3.2.6/lib/rails/initia
lizable.rb:54:in `each'
from C:/Ruby193/lib/ruby/gems/1.9.1/gems/railties-3.2.6/lib/rails/initia
lizable.rb:54:in `run_initializers'
from C:/Ruby193/lib/ruby/gems/1.9.1/gems/railties-3.2.6/lib/rails/applic
ation.rb:136:in `initialize!'
from C:/Ruby193/lib/ruby/gems/1.9.1/gems/railties-3.2.6/lib/rails/railti
e/configurable.rb:30:in `method_missing'
from D:/myblog/config/environment.rb:5:in `<top (required)>'
from D:/myblog/config.ru:3:in `require'
from D:/myblog/config.ru:3:in `block in <main>'
from C:/Ruby193/lib/ruby/gems/1.9.1/gems/rack-1.4.4/lib/rack/builder.rb:
51:in `instance_eval'
from C:/Ruby193/lib/ruby/gems/1.9.1/gems/rack-1.4.4/lib/rack/builder.rb:
51:in `initialize'
from D:/myblog/config.ru:in `new'
from D:/myblog/config.ru:in `<main>'
from C:/Ruby193/lib/ruby/gems/1.9.1/gems/rack-1.4.4/lib/rack/builder.rb:
40:in `eval'
from C:/Ruby193/lib/ruby/gems/1.9.1/gems/rack-1.4.4/lib/rack/builder.rb:
40:in `parse_file'
from C:/Ruby193/lib/ruby/gems/1.9.1/gems/rack-1.4.4/lib/rack/server.rb:2
00:in `app'
from C:/Ruby193/lib/ruby/gems/1.9.1/gems/railties-3.2.6/lib/rails/comman
ds/server.rb:46:in `app'
from C:/Ruby193/lib/ruby/gems/1.9.1/gems/rack-1.4.4/lib/rack/server.rb:3
04:in `wrapped_app'
from C:/Ruby193/lib/ruby/gems/1.9.1/gems/rack-1.4.4/lib/rack/server.rb:2
54:in `start'
from C:/Ruby193/lib/ruby/gems/1.9.1/gems/railties-3.2.6/lib/rails/comman
ds/server.rb:70:in `start'
from C:/Ruby193/lib/ruby/gems/1.9.1/gems/railties-3.2.6/lib/rails/comman
ds.rb:55:in `block in <top (required)>'
from C:/Ruby193/lib/ruby/gems/1.9.1/gems/railties-3.2.6/lib/rails/comman
ds.rb:50:in `tap'
from C:/Ruby193/lib/ruby/gems/1.9.1/gems/railties-3.2.6/lib/rails/comman
ds.rb:50:in `<top (required)>'
from script/rails:6:in `require'
from script/rails:6:in `<main>'
When I run rake routes It shows me this:
rake aborted!
missing :action
D:/myblog/config/routes.rb:5:in `block in <top (required)>'
D:/myblog/config/routes.rb:1:in `<top (required)>'
C:in `execute_if_updated'
D:/myblog/config/environment.rb:5:in `<top (required)>'
Tasks: TOP => routes => environment
(See full trace by running task with --trace)
My Routes.rb file:
Myblog::Application.routes.draw do
resources :posts, :has_many => :comments
match ':controller/:action/:id'
match ':controller/:action/:id.:format'
root :to => "post"
end
I know It's rather fuzzy but I have no idea how to show It simplier. Thanks for help & intrest!
You're missing an action in the root url e.g.
root :to => "posts#index"
#index being the controller action