Tithos Tithos - 6 months ago 285
Ruby Question

Rake route Error "Missing :action key on routes definition"

I am getting

$ rake routes
rake aborted!
ArgumentError: Missing :action key on routes definition, please check your routes.
/usr/local/rvm/gems/ruby-2.1.2/gems/actionpack-4.1.5/lib/action_dispatch/routing/mapper.rb:243:in `default_controller_and_action'
/usr/local/rvm/gems/ruby-2.1.2/gems/actionpack-4.1.5/lib/action_dispatch/routing/mapper.rb:117:in `normalize_options!'
/usr/local/rvm/gems/ruby-2.1.2/gems/actionpack-4.1.5/lib/action_dispatch/routing/mapper.rb:65:in `initialize'
/usr/local/rvm/gems/ruby-2.1.2/gems/actionpack-4.1.5/lib/action_dispatch/routing/mapper.rb:1487:in `new'
/usr/local/r................


Here is my Routes.rb

Rails.application.routes.draw do
get 'script/index'

get 'landing/index'

root 'landing/index'
end


What is causing the problem and how do I fix it.

Answer
Rails.application.routes.draw do
  get 'script/index' => 'script#index'
  get 'landing/index' => 'landing#index'
  root 'script#index'
end