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 trial

Ruby Build a Todo List Application with Rails 4 Build a Todo List Application with Rails 4 Generate a Scaffold

Anuj Nagpal
PLUS
Anuj Nagpal
Courses Plus Student 3,748 Points

Server 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 methodreverse_merge' for "todo_lists#index":String (NoMethodError)

1 Answer

Hi 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
Anuj Nagpal
Courses Plus Student 3,748 Points

SECURITY 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 methodreverse_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:in root' from /Users/anuj.nagpal/project/odot/config/routes.rb:3:inblock 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:in instance_exec' from /Users/anuj.nagpal/.rvm/gems/ruby-2.1.2/gems/actionpack-3.1.3/lib/action_dispatch/routing/route_set.rb:258:ineval_block' from /Users/anuj.nagpal/.rvm/gems/ruby-2.1.2/gems/actionpack-3.1.3/lib/action_dispatch/routing/route_set.rb:235:in draw' 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:in load' from /Users/anuj.nagpal/.rvm/gems/ruby-2.1.2/gems/activesupport-3.1.3/lib/active_support/dependencies.rb:234:inblock in load' from /Users/anuj.nagpal/.rvm/gems/ruby-2.1.2/gems/activesupport-3.1.3/lib/active_support/dependencies.rb:223:in block in load_dependency' from /Users/anuj.nagpal/.rvm/gems/ruby-2.1.2/gems/activesupport-3.1.3/lib/active_support/dependencies.rb:640:innew_constants_in' from /Users/anuj.nagpal/.rvm/gems/ruby-2.1.2/gems/activesupport-3.1.3/lib/active_support/dependencies.rb:223:in load_dependency' 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/railties-3.1.3/lib/rails/application/routes_reloader.rb:29:in block 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:ineach' from /Users/anuj.nagpal/.rvm/gems/ruby-2.1.2/gems/railties-3.1.3/lib/rails/application/routes_reloader.rb:29:in load_paths' from /Users/anuj.nagpal/.rvm/gems/ruby-2.1.2/gems/railties-3.1.3/lib/rails/application/routes_reloader.rb:13:inreload!' from /Users/anuj.nagpal/.rvm/gems/ruby-2.1.2/gems/railties-3.1.3/lib/rails/application/routes_reloader.rb:7:in block 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:incall' from /Users/anuj.nagpal/.rvm/gems/ruby-2.1.2/gems/activesupport-3.1.3/lib/active_support/file_update_checker.rb:32:in execute_if_updated' from /Users/anuj.nagpal/.rvm/gems/ruby-2.1.2/gems/railties-3.1.3/lib/rails/application/finisher.rb:63:inblock (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:in call' from /Users/anuj.nagpal/.rvm/gems/ruby-2.1.2/gems/railties-3.1.3/lib/rails/application/finisher.rb:64:inblock in <module:Finisher>' from /Users/anuj.nagpal/.rvm/gems/ruby-2.1.2/gems/railties-3.1.3/lib/rails/initializable.rb:30:in instance_exec' from /Users/anuj.nagpal/.rvm/gems/ruby-2.1.2/gems/railties-3.1.3/lib/rails/initializable.rb:30:inrun' from /Users/anuj.nagpal/.rvm/gems/ruby-2.1.2/gems/railties-3.1.3/lib/rails/initializable.rb:55:in block in run_initializers' from /Users/anuj.nagpal/.rvm/gems/ruby-2.1.2/gems/railties-3.1.3/lib/rails/initializable.rb:54:ineach' from /Users/anuj.nagpal/.rvm/gems/ruby-2.1.2/gems/railties-3.1.3/lib/rails/initializable.rb:54:in run_initializers' from /Users/anuj.nagpal/.rvm/gems/ruby-2.1.2/gems/railties-3.1.3/lib/rails/application.rb:96:ininitialize!' from /Users/anuj.nagpal/.rvm/gems/ruby-2.1.2/gems/railties-3.1.3/lib/rails/railtie/configurable.rb:30:in method_missing' from /Users/anuj.nagpal/project/odot/config/environment.rb:5:in<top (required)>' from /Users/anuj.nagpal/project/odot/config.ru:3:in require' from /Users/anuj.nagpal/project/odot/config.ru:3:inblock in <main>' from /Users/anuj.nagpal/.rvm/gems/ruby-2.1.2/gems/rack-1.3.10/lib/rack/builder.rb:51:in instance_eval' from /Users/anuj.nagpal/.rvm/gems/ruby-2.1.2/gems/rack-1.3.10/lib/rack/builder.rb:51:ininitialize' from /Users/anuj.nagpal/project/odot/config.ru:in new' 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:in eval' from /Users/anuj.nagpal/.rvm/gems/ruby-2.1.2/gems/rack-1.3.10/lib/rack/builder.rb:40:inparse_file' from /Users/anuj.nagpal/.rvm/gems/ruby-2.1.2/gems/rack-1.3.10/lib/rack/server.rb:200:in app' from /Users/anuj.nagpal/.rvm/gems/ruby-2.1.2/gems/railties-3.1.3/lib/rails/commands/server.rb:46:inapp' from /Users/anuj.nagpal/.rvm/gems/ruby-2.1.2/gems/rack-1.3.10/lib/rack/server.rb:304:in wrapped_app' from /Users/anuj.nagpal/.rvm/gems/ruby-2.1.2/gems/rack-1.3.10/lib/rack/server.rb:254:instart' from /Users/anuj.nagpal/.rvm/gems/ruby-2.1.2/gems/railties-3.1.3/lib/rails/commands/server.rb:70:in start' from /Users/anuj.nagpal/.rvm/gems/ruby-2.1.2/gems/railties-3.1.3/lib/rails/commands.rb:54:inblock in <top (required)>' from /Users/anuj.nagpal/.rvm/gems/ruby-2.1.2/gems/railties-3.1.3/lib/rails/commands.rb:49:in tap' 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:in require' from script/rails:6:in<main>'

I'm using Rails 3.1.3

Interesting error - and very confusing!

The central cause seems to be something to do with your code "todo_lists#index" which is probably in routes.rb but the error itself is not particularly helpful. There's some mention of environment.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 in routes.rb?

I'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.