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.
Related
I'm trying to run rails console but I'm getting a bunch of messages and I'm not being able to determine where exactly the issue is. Other Rails commands are working.
I've seen suggestions to run spring stop or comment spring in the gemfile but neither of those worked.
I'm getting this in my terminal:
rails console
/home/lutzcc1/code/lutzcc1/rails-task-manager/config/routes.rb:4:in `block in <main>': undefined local variable or method `new_task' for #<ActionDispatch::Routing::Mapper:0x0000557103736ee0> (NameError)
from /home/lutzcc1/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/actionpack-6.0.2.2/lib/action_dispatch/routing/route_set.rb:429:in `instance_exec'
from /home/lutzcc1/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/actionpack-6.0.2.2/lib/action_dispatch/routing/route_set.rb:429:in `eval_block'
from /home/lutzcc1/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/actionpack-6.0.2.2/lib/action_dispatch/routing/route_set.rb:411:in `draw'
from /home/lutzcc1/code/lutzcc1/rails-task-manager/config/routes.rb:1:in `<main>'
from /home/lutzcc1/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/bootsnap-1.4.6/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:55:in `load'
from /home/lutzcc1/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/bootsnap-1.4.6/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:55:in `load'
from /home/lutzcc1/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/railties-6.0.2.2/lib/rails/application/routes_reloader.rb:41:in `block in load_paths'
from /home/lutzcc1/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/railties-6.0.2.2/lib/rails/application/routes_reloader.rb:41:in `each'
from /home/lutzcc1/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/railties-6.0.2.2/lib/rails/application/routes_reloader.rb:41:in `load_paths'
from /home/lutzcc1/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/railties-6.0.2.2/lib/rails/application/routes_reloader.rb:20:in `reload!'
from /home/lutzcc1/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/railties-6.0.2.2/lib/rails/application/routes_reloader.rb:30:in `block in updater'
from /home/lutzcc1/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/activesupport-6.0.2.2/lib/active_support/file_update_checker.rb:83:in `execute'
from /home/lutzcc1/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/railties-6.0.2.2/lib/rails/application/routes_reloader.rb:10:in `execute'
from /home/lutzcc1/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/railties-6.0.2.2/lib/rails/application/finisher.rb:184:in `block in <module:Finisher>'
from /home/lutzcc1/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/railties-6.0.2.2/lib/rails/initializable.rb:32:in `instance_exec'
from /home/lutzcc1/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/railties-6.0.2.2/lib/rails/initializable.rb:32:in `run'
from /home/lutzcc1/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/railties-6.0.2.2/lib/rails/initializable.rb:61:in `block in run_initializers'
from /home/lutzcc1/.rbenv/versions/2.6.6/lib/ruby/2.6.0/tsort.rb:228:in `block in tsort_each'
from /home/lutzcc1/.rbenv/versions/2.6.6/lib/ruby/2.6.0/tsort.rb:350:in `block (2 levels) in each_strongly_connected_component'
from /home/lutzcc1/.rbenv/versions/2.6.6/lib/ruby/2.6.0/tsort.rb:431:in `each_strongly_connected_component_from'
from /home/lutzcc1/.rbenv/versions/2.6.6/lib/ruby/2.6.0/tsort.rb:349:in `block in each_strongly_connected_component'
from /home/lutzcc1/.rbenv/versions/2.6.6/lib/ruby/2.6.0/tsort.rb:347:in `each'
from /home/lutzcc1/.rbenv/versions/2.6.6/lib/ruby/2.6.0/tsort.rb:347:in `call'
from /home/lutzcc1/.rbenv/versions/2.6.6/lib/ruby/2.6.0/tsort.rb:347:in `each_strongly_connected_component'
from /home/lutzcc1/.rbenv/versions/2.6.6/lib/ruby/2.6.0/tsort.rb:226:in `tsort_each'
from /home/lutzcc1/.rbenv/versions/2.6.6/lib/ruby/2.6.0/tsort.rb:205:in `tsort_each'
from /home/lutzcc1/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/railties-6.0.2.2/lib/rails/initializable.rb:60:in `run_initializers'
from /home/lutzcc1/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/railties-6.0.2.2/lib/rails/application.rb:363:in `initialize!'
from /home/lutzcc1/code/lutzcc1/rails-task-manager/config/environment.rb:5:in `<main>'
from /home/lutzcc1/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/bootsnap-1.4.6/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in `require'
from /home/lutzcc1/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/bootsnap-1.4.6/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in `block in require_with_bootsnap_lfi'
from /home/lutzcc1/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/bootsnap-1.4.6/lib/bootsnap/load_path_cache/loaded_features_index.rb:92:in `register'
from /home/lutzcc1/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/bootsnap-1.4.6/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:22:in `require_with_bootsnap_lfi'
from /home/lutzcc1/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/bootsnap-1.4.6/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:31:in `require'
from /home/lutzcc1/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/zeitwerk-2.3.0/lib/zeitwerk/kernel.rb:23:in `require'
from /home/lutzcc1/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/activesupport-6.0.2.2/lib/active_support/dependencies.rb:325:in `block in require'
from /home/lutzcc1/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/activesupport-6.0.2.2/lib/active_support/dependencies.rb:291:in `load_dependency'
from /home/lutzcc1/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/activesupport-6.0.2.2/lib/active_support/dependencies.rb:325:in `require'
from /home/lutzcc1/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/spring-2.1.0/lib/spring/application.rb:106:in `preload'
from /home/lutzcc1/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/spring-2.1.0/lib/spring/application.rb:157:in `serve'
from /home/lutzcc1/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/spring-2.1.0/lib/spring/application.rb:145:in `block in run'
from /home/lutzcc1/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/spring-2.1.0/lib/spring/application.rb:139:in `loop'
from /home/lutzcc1/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/spring-2.1.0/lib/spring/application.rb:139:in `run'
from /home/lutzcc1/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/spring-2.1.0/lib/spring/application/boot.rb:19:in `<top (required)>'
from /home/lutzcc1/.rbenv/versions/2.6.6/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `require'
from /home/lutzcc1/.rbenv/versions/2.6.6/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `require'
from -e:1:in `<main>'
Here is my routes file:
Rails.application.routes.draw do
get 'tasks', to: 'tasks#index'
get 'tasks/new', to: 'tasks#new', as: new_task
post 'tasks', to: 'tasks#create'
get 'tasks/:id', to: 'tasks#show', as: tasks
get 'tasks/:id/edit', to: 'task#edit', as: edit_task
patch 'tasks/:id', to: 'task#update'
delete 'task/:id', to: 'task#destroy'
end
Here's the problem:
as: new_task
You probably meant
as: :new_task
That's why rails complains about an undefined method or variable new_task
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.
I am able to generate a url and associated web page with the help of the rails generate controller static_pages about. So the url would be something like this www.bla.com/static_pages/about'. Now I want to generate this urlbla.com/help` without the use of generate,
I added a route in routes.rb like this
get 'help'
Then I added an action in application_controller.rb like this
def hello
render text: "Hello"
end
Then when started the server, I get the following error
Exiting
/usr/local/rvm/gems/ruby-2.2.1/gems/actionpack-4.2.2/lib/action_dispatch/routing/mapper.rb:275:in `check_part': Missing :controller key on routes definition, please check your routes. (ArgumentError)
from /usr/local/rvm/gems/ruby-2.2.1/gems/actionpack-4.2.2/lib/action_dispatch/routing/mapper.rb:255:in `check_controller_and_action'
from /usr/local/rvm/gems/ruby-2.2.1/gems/actionpack-4.2.2/lib/action_dispatch/routing/mapper.rb:178:in `normalize_options!'
from /usr/local/rvm/gems/ruby-2.2.1/gems/actionpack-4.2.2/lib/action_dispatch/routing/mapper.rb:100:in `initialize'
from /usr/local/rvm/gems/ruby-2.2.1/gems/actionpack-4.2.2/lib/action_dispatch/routing/mapper.rb:78:in `new'
from /usr/local/rvm/gems/ruby-2.2.1/gems/actionpack-4.2.2/lib/action_dispatch/routing/mapper.rb:78:in `build'
from /usr/local/rvm/gems/ruby-2.2.1/gems/actionpack-4.2.2/lib/action_dispatch/routing/mapper.rb:1559:in `add_route'
from /usr/local/rvm/gems/ruby-2.2.1/gems/actionpack-4.2.2/lib/action_dispatch/routing/mapper.rb:1536:in `decomposed_match'
from /usr/local/rvm/gems/ruby-2.2.1/gems/actionpack-4.2.2/lib/action_dispatch/routing/mapper.rb:1517:in `block in match'
from /usr/local/rvm/gems/ruby-2.2.1/gems/actionpack-4.2.2/lib/action_dispatch/routing/mapper.rb:1507:in `each'
from /usr/local/rvm/gems/ruby-2.2.1/gems/actionpack-4.2.2/lib/action_dispatch/routing/mapper.rb:1507:in `match'
from /usr/local/rvm/gems/ruby-2.2.1/gems/actionpack-4.2.2/lib/action_dispatch/routing/mapper.rb:689:in `map_method'
from /usr/local/rvm/gems/ruby-2.2.1/gems/actionpack-4.2.2/lib/action_dispatch/routing/mapper.rb:650:in `get'
from /home/ubuntu/workspace/sample_app/config/routes.rb:12:in `block in <top (required)>'
from /usr/local/rvm/gems/ruby-2.2.1/gems/actionpack-4.2.2/lib/action_dispatch/routing/route_set.rb:432:in `instance_exec'
from /usr/local/rvm/gems/ruby-2.2.1/gems/actionpack-4.2.2/lib/action_dispatch/routing/route_set.rb:432:in `eval_block'
from /usr/local/rvm/gems/ruby-2.2.1/gems/actionpack-4.2.2/lib/action_dispatch/routing/route_set.rb:410:in `draw'
from /home/ubuntu/workspace/sample_app/config/routes.rb:1:in `<top (required)>'
from /usr/local/rvm/gems/ruby-2.2.1/gems/activesupport-4.2.2/lib/active_support/dependencies.rb:268:in `load'
from /usr/local/rvm/gems/ruby-2.2.1/gems/activesupport-4.2.2/lib/active_support/dependencies.rb:268:in `block in load'
from /usr/local/rvm/gems/ruby-2.2.1/gems/activesupport-4.2.2/lib/active_support/dependencies.rb:240:in `load_dependency'
from /usr/local/rvm/gems/ruby-2.2.1/gems/activesupport-4.2.2/lib/active_support/dependencies.rb:268:in `load'
from /usr/local/rvm/gems/ruby-2.2.1/gems/railties-4.2.2/lib/rails/application/routes_reloader.rb:40:in `block in load_paths'
from /usr/local/rvm/gems/ruby-2.2.1/gems/railties-4.2.2/lib/rails/application/routes_reloader.rb:40:in `each'
from /usr/local/rvm/gems/ruby-2.2.1/gems/railties-4.2.2/lib/rails/application/routes_reloader.rb:40:in `load_paths'
from /usr/local/rvm/gems/ruby-2.2.1/gems/railties-4.2.2/lib/rails/application/routes_reloader.rb:16:in `reload!'
from /usr/local/rvm/gems/ruby-2.2.1/gems/railties-4.2.2/lib/rails/application/routes_reloader.rb:26:in `block in updater'
from /usr/local/rvm/gems/ruby-2.2.1/gems/activesupport-4.2.2/lib/active_support/file_update_checker.rb:75:in `call'
from /usr/local/rvm/gems/ruby-2.2.1/gems/activesupport-4.2.2/lib/active_support/file_update_checker.rb:75:in `execute'
from /usr/local/rvm/gems/ruby-2.2.1/gems/railties-4.2.2/lib/rails/application/routes_reloader.rb:27:in `updater'
from /usr/local/rvm/gems/ruby-2.2.1/gems/railties-4.2.2/lib/rails/application/routes_reloader.rb:7:in `execute_if_updated'
from /usr/local/rvm/gems/ruby-2.2.1/gems/railties-4.2.2/lib/rails/application/finisher.rb:69:in `block in <module:Finisher>'
from /usr/local/rvm/gems/ruby-2.2.1/gems/railties-4.2.2/lib/rails/initializable.rb:30:in `instance_exec'
from /usr/local/rvm/gems/ruby-2.2.1/gems/railties-4.2.2/lib/rails/initializable.rb:30:in `run'
from /usr/local/rvm/gems/ruby-2.2.1/gems/railties-4.2.2/lib/rails/initializable.rb:55:in `block in run_initializers'
from /usr/local/rvm/rubies/ruby-2.2.1/lib/ruby/2.2.0/tsort.rb:226:in `block in tsort_each'
from /usr/local/rvm/rubies/ruby-2.2.1/lib/ruby/2.2.0/tsort.rb:348:in `block (2 levels) in each_strongly_connected_component'
from /usr/local/rvm/rubies/ruby-2.2.1/lib/ruby/2.2.0/tsort.rb:429:in `each_strongly_connected_component_from'
from /usr/local/rvm/rubies/ruby-2.2.1/lib/ruby/2.2.0/tsort.rb:347:in `block in each_strongly_connected_component'
from /usr/local/rvm/rubies/ruby-2.2.1/lib/ruby/2.2.0/tsort.rb:345:in `each'
from /usr/local/rvm/rubies/ruby-2.2.1/lib/ruby/2.2.0/tsort.rb:345:in `call'
from /usr/local/rvm/rubies/ruby-2.2.1/lib/ruby/2.2.0/tsort.rb:345:in `each_strongly_connected_component'
from /usr/local/rvm/rubies/ruby-2.2.1/lib/ruby/2.2.0/tsort.rb:224:in `tsort_each'
from /usr/local/rvm/rubies/ruby-2.2.1/lib/ruby/2.2.0/tsort.rb:203:in `tsort_each'
from /usr/local/rvm/gems/ruby-2.2.1/gems/railties-4.2.2/lib/rails/initializable.rb:54:in `run_initializers'
from /usr/local/rvm/gems/ruby-2.2.1/gems/railties-4.2.2/lib/rails/application.rb:352:in `initialize!'
from /home/ubuntu/workspace/sample_app/config/environment.rb:5:in `<top (required)>'
from /home/ubuntu/workspace/sample_app/config.ru:3:in `require'
from /home/ubuntu/workspace/sample_app/config.ru:3:in `block in <main>'
from /usr/local/rvm/gems/ruby-2.2.1/gems/rack-1.6.4/lib/rack/builder.rb:55:in `instance_eval'
from /usr/local/rvm/gems/ruby-2.2.1/gems/rack-1.6.4/lib/rack/builder.rb:55:in `initialize'
from /home/ubuntu/workspace/sample_app/config.ru:in `new'
from /home/ubuntu/workspace/sample_app/config.ru:in `<main>'
from /usr/local/rvm/gems/ruby-2.2.1/gems/rack-1.6.4/lib/rack/builder.rb:49:in `eval'
from /usr/local/rvm/gems/ruby-2.2.1/gems/rack-1.6.4/lib/rack/builder.rb:49:in `new_from_string'
from /usr/local/rvm/gems/ruby-2.2.1/gems/rack-1.6.4/lib/rack/builder.rb:40:in `parse_file'
from /usr/local/rvm/gems/ruby-2.2.1/gems/rack-1.6.4/lib/rack/server.rb:299:in `build_app_and_options_from_config'
from /usr/local/rvm/gems/ruby-2.2.1/gems/rack-1.6.4/lib/rack/server.rb:208:in `app'
from /usr/local/rvm/gems/ruby-2.2.1/gems/railties-4.2.2/lib/rails/commands/server.rb:61:in `app'
from /usr/local/rvm/gems/ruby-2.2.1/gems/rack-1.6.4/lib/rack/server.rb:336:in `wrapped_app'
from /usr/local/rvm/gems/ruby-2.2.1/gems/railties-4.2.2/lib/rails/commands/server.rb:139:in `log_to_stdout'
from /usr/local/rvm/gems/ruby-2.2.1/gems/railties-4.2.2/lib/rails/commands/server.rb:78:in `start'
from /usr/local/rvm/gems/ruby-2.2.1/gems/railties-4.2.2/lib/rails/commands/commands_tasks.rb:80:in `block in server'
from /usr/local/rvm/gems/ruby-2.2.1/gems/railties-4.2.2/lib/rails/commands/commands_tasks.rb:75:in `tap'
from /usr/local/rvm/gems/ruby-2.2.1/gems/railties-4.2.2/lib/rails/commands/commands_tasks.rb:75:in `server'
from /usr/local/rvm/gems/ruby-2.2.1/gems/railties-4.2.2/lib/rails/commands/commands_tasks.rb:39:in `run_command!'
from /usr/local/rvm/gems/ruby-2.2.1/gems/railties-4.2.2/lib/rails/commands.rb:17:in `<top (required)>'
from /home/ubuntu/workspace/sample_app/bin/rails:8:in `require'
from /home/ubuntu/workspace/sample_app/bin/rails:8:in `<top (required)>'
from /usr/local/rvm/gems/ruby-2.2.1/gems/spring-1.1.3/lib/spring/client/rails.rb:27:in `load'
from /usr/local/rvm/gems/ruby-2.2.1/gems/spring-1.1.3/lib/spring/client/rails.rb:27:in `call'
from /usr/local/rvm/gems/ruby-2.2.1/gems/spring-1.1.3/lib/spring/client/command.rb:7:in `call'
from /usr/local/rvm/gems/ruby-2.2.1/gems/spring-1.1.3/lib/spring/client.rb:26:in `run'
from /usr/local/rvm/gems/ruby-2.2.1/gems/spring-1.1.3/bin/spring:48:in `<top (required)>'
from /usr/local/rvm/gems/ruby-2.2.1/gems/spring-1.1.3/lib/spring/binstub.rb:11:in `load'
from /usr/local/rvm/gems/ruby-2.2.1/gems/spring-1.1.3/lib/spring/binstub.rb:11:in `<top (required)>'
from /home/ubuntu/workspace/sample_app/bin/spring:13:in `require'
from /home/ubuntu/workspace/sample_app/bin/spring:13:in `<top (required)>'
from bin/rails:3:in `load'
from bin/rails:3:in `<main>'
Missing :controller key on routes definition, please check your
routes. (ArgumentError)
As the error states, you need to specify controller and action matching to the route. The below should work.
get "help", to: 'static_pages#about', as: 'help'
^^^^^^ ^^^^
controller action
Also, I suggest you to follow these Guides for clear understanding on how to define the routes.
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'
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