Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialAnuj Nagpal
Courses Plus Student 3,748 PointsServer not getting restart after adding root 'todo_lists#index'
/Users/anuj.nagpal/.rvm/gems/ruby-2.1.2/gems/actionpack-3.1.3/lib/action_dispatch/routing/mapper.rb:264:in root': undefined method
reverse_merge' for "todo_lists#index":String (NoMethodError)
1 Answer
Steve Hunter
57,712 PointsHi there,
Can you copy the rest of the error message. The issue is likely to come from one of your files. Looking at what you've pasted, the issue may be in routes.rb
but the error may point us in the right direction.
Steve.
Anuj Nagpal
Courses Plus Student 3,748 PointsAnuj Nagpal
Courses Plus Student 3,748 PointsSECURITY WARNING: No secret option provided to Rack::Session::Cookie. This poses a security threat. It is strongly recommended that you provide a secret to prevent exploits that may be possible from crafted cookies. This will not be supported in future versions of Rack, and future versions will even invalidate your existing user cookies.
Called from: /Users/anuj.nagpal/.rvm/gems/ruby-2.1.2/gems/actionpack-3.1.3/lib/action_dispatch/middleware/session/abstract_store.rb:28:in `initialize'.
/Users/anuj.nagpal/.rvm/gems/ruby-2.1.2/gems/actionpack-3.1.3/lib/action_dispatch/routing/mapper.rb:264:in
root': undefined method
reverse_merge' for "todo_lists#index":String (NoMethodError) from /Users/anuj.nagpal/.rvm/gems/ruby-2.1.2/gems/actionpack-3.1.3/lib/action_dispatch/routing/mapper.rb:1303:inroot' from /Users/anuj.nagpal/project/odot/config/routes.rb:3:in
block in <top (required)>' from /Users/anuj.nagpal/.rvm/gems/ruby-2.1.2/gems/actionpack-3.1.3/lib/action_dispatch/routing/route_set.rb:258:ininstance_exec' from /Users/anuj.nagpal/.rvm/gems/ruby-2.1.2/gems/actionpack-3.1.3/lib/action_dispatch/routing/route_set.rb:258:in
eval_block' from /Users/anuj.nagpal/.rvm/gems/ruby-2.1.2/gems/actionpack-3.1.3/lib/action_dispatch/routing/route_set.rb:235:indraw' from /Users/anuj.nagpal/project/odot/config/routes.rb:1:in
<top (required)>' from /Users/anuj.nagpal/.rvm/gems/ruby-2.1.2/gems/activesupport-3.1.3/lib/active_support/dependencies.rb:234:inload' from /Users/anuj.nagpal/.rvm/gems/ruby-2.1.2/gems/activesupport-3.1.3/lib/active_support/dependencies.rb:234:in
block in load' from /Users/anuj.nagpal/.rvm/gems/ruby-2.1.2/gems/activesupport-3.1.3/lib/active_support/dependencies.rb:223:inblock in load_dependency' from /Users/anuj.nagpal/.rvm/gems/ruby-2.1.2/gems/activesupport-3.1.3/lib/active_support/dependencies.rb:640:in
new_constants_in' from /Users/anuj.nagpal/.rvm/gems/ruby-2.1.2/gems/activesupport-3.1.3/lib/active_support/dependencies.rb:223:inload_dependency' from /Users/anuj.nagpal/.rvm/gems/ruby-2.1.2/gems/activesupport-3.1.3/lib/active_support/dependencies.rb:234:in
load' from /Users/anuj.nagpal/.rvm/gems/ruby-2.1.2/gems/railties-3.1.3/lib/rails/application/routes_reloader.rb:29:inblock in load_paths' from /Users/anuj.nagpal/.rvm/gems/ruby-2.1.2/gems/railties-3.1.3/lib/rails/application/routes_reloader.rb:29:in
each' from /Users/anuj.nagpal/.rvm/gems/ruby-2.1.2/gems/railties-3.1.3/lib/rails/application/routes_reloader.rb:29:inload_paths' from /Users/anuj.nagpal/.rvm/gems/ruby-2.1.2/gems/railties-3.1.3/lib/rails/application/routes_reloader.rb:13:in
reload!' from /Users/anuj.nagpal/.rvm/gems/ruby-2.1.2/gems/railties-3.1.3/lib/rails/application/routes_reloader.rb:7:inblock in initialize' from /Users/anuj.nagpal/.rvm/gems/ruby-2.1.2/gems/activesupport-3.1.3/lib/active_support/file_update_checker.rb:32:in
call' from /Users/anuj.nagpal/.rvm/gems/ruby-2.1.2/gems/activesupport-3.1.3/lib/active_support/file_update_checker.rb:32:inexecute_if_updated' from /Users/anuj.nagpal/.rvm/gems/ruby-2.1.2/gems/railties-3.1.3/lib/rails/application/finisher.rb:63:in
block (2 levels) in <module:Finisher>' from /Users/anuj.nagpal/.rvm/gems/ruby-2.1.2/gems/railties-3.1.3/lib/rails/application/finisher.rb:64:incall' from /Users/anuj.nagpal/.rvm/gems/ruby-2.1.2/gems/railties-3.1.3/lib/rails/application/finisher.rb:64:in
block in <module:Finisher>' from /Users/anuj.nagpal/.rvm/gems/ruby-2.1.2/gems/railties-3.1.3/lib/rails/initializable.rb:30:ininstance_exec' from /Users/anuj.nagpal/.rvm/gems/ruby-2.1.2/gems/railties-3.1.3/lib/rails/initializable.rb:30:in
run' from /Users/anuj.nagpal/.rvm/gems/ruby-2.1.2/gems/railties-3.1.3/lib/rails/initializable.rb:55:inblock in run_initializers' from /Users/anuj.nagpal/.rvm/gems/ruby-2.1.2/gems/railties-3.1.3/lib/rails/initializable.rb:54:in
each' from /Users/anuj.nagpal/.rvm/gems/ruby-2.1.2/gems/railties-3.1.3/lib/rails/initializable.rb:54:inrun_initializers' from /Users/anuj.nagpal/.rvm/gems/ruby-2.1.2/gems/railties-3.1.3/lib/rails/application.rb:96:in
initialize!' from /Users/anuj.nagpal/.rvm/gems/ruby-2.1.2/gems/railties-3.1.3/lib/rails/railtie/configurable.rb:30:inmethod_missing' from /Users/anuj.nagpal/project/odot/config/environment.rb:5:in
<top (required)>' from /Users/anuj.nagpal/project/odot/config.ru:3:inrequire' from /Users/anuj.nagpal/project/odot/config.ru:3:in
block in <main>' from /Users/anuj.nagpal/.rvm/gems/ruby-2.1.2/gems/rack-1.3.10/lib/rack/builder.rb:51:ininstance_eval' from /Users/anuj.nagpal/.rvm/gems/ruby-2.1.2/gems/rack-1.3.10/lib/rack/builder.rb:51:in
initialize' from /Users/anuj.nagpal/project/odot/config.ru:innew' from /Users/anuj.nagpal/project/odot/config.ru:in
<main>' from /Users/anuj.nagpal/.rvm/gems/ruby-2.1.2/gems/rack-1.3.10/lib/rack/builder.rb:40:ineval' from /Users/anuj.nagpal/.rvm/gems/ruby-2.1.2/gems/rack-1.3.10/lib/rack/builder.rb:40:in
parse_file' from /Users/anuj.nagpal/.rvm/gems/ruby-2.1.2/gems/rack-1.3.10/lib/rack/server.rb:200:inapp' from /Users/anuj.nagpal/.rvm/gems/ruby-2.1.2/gems/railties-3.1.3/lib/rails/commands/server.rb:46:in
app' from /Users/anuj.nagpal/.rvm/gems/ruby-2.1.2/gems/rack-1.3.10/lib/rack/server.rb:304:inwrapped_app' from /Users/anuj.nagpal/.rvm/gems/ruby-2.1.2/gems/rack-1.3.10/lib/rack/server.rb:254:in
start' from /Users/anuj.nagpal/.rvm/gems/ruby-2.1.2/gems/railties-3.1.3/lib/rails/commands/server.rb:70:instart' from /Users/anuj.nagpal/.rvm/gems/ruby-2.1.2/gems/railties-3.1.3/lib/rails/commands.rb:54:in
block in <top (required)>' from /Users/anuj.nagpal/.rvm/gems/ruby-2.1.2/gems/railties-3.1.3/lib/rails/commands.rb:49:intap' from /Users/anuj.nagpal/.rvm/gems/ruby-2.1.2/gems/railties-3.1.3/lib/rails/commands.rb:49:in
<top (required)>' from script/rails:6:inrequire' from script/rails:6:in
<main>'I'm using Rails 3.1.3
Steve Hunter
57,712 PointsSteve Hunter
57,712 PointsInteresting error - and very confusing!
The central cause seems to be something to do with your code
"todo_lists#index"
which is probably inroutes.rb
but the error itself is not particularly helpful. There's some mention ofenvironment.rb
but that probably just starts the whole application.I don't know if there's anything peculiar to Rails 3.2.1, I've never used it - my machine is on 4.2.1.
So, your error is occuring when you run
rails s
and it wasn't doing that before you added"todo_lists#index"
. Where did you add that - just inroutes.rb
?Anuj Nagpal
Courses Plus Student 3,748 PointsAnuj Nagpal
Courses Plus Student 3,748 Pointsyes I just added it to routes.eb no where else
Steve Hunter
57,712 PointsSteve Hunter
57,712 PointsI've had a Google and come up with a load of pages that contain code that's well over my head! This one, for example!
There is quite a lot of mention of older Rails versions in the various pages so that may be a factor here.
It is probably well worth asking Jason Seifer for some help - Jason has probably come across this before.
Steve.