Issue with setting up rails application. It worked the first time but later when i reopen it and tried to run 'rails server' it doesn't work and returns following error. Thanks.
I am using ruby 2.3.1p112 rails 5.0 mysql 5.7.13 $ rails server
=> Booting Puma
=> Rails 5.0.0 application starting in development on http://localhost:3000
=> Run rails server -h
for more startup options
Exiting
/Users/bruce/sea/config/routes.rb:6:in `<top (required)>': undefined
method `root' for main:Object (NoMethodError)
from /Users/bruce/.rvm/gems/ruby-2.3.1@global/gems/activesupport-
5.0.0/lib/active_support/dependencies.rb:287:in `load'
from /Users/bruce/.rvm/gems/ruby-2.3.1@global/gems/activesupport-
5.0.0/lib/active_support/dependencies.rb:287:in `block in load'
from /Users/bruce/.rvm/gems/ruby-2.3.1@global/gems/activesupport-
5.0.0/lib/active_support/dependencies.rb:259:in `load_dependency'
from /Users/bruce/.rvm/gems/ruby-2.3.1@global/gems/activesupport-
5.0.0/lib/active_support/dependencies.rb:287:in `load'
from /Users/bruce/.rvm/gems/ruby-2.3.1@global/gems/railties-5.0.0/lib
/rails/application/routes_reloader.rb:40:in `block in load_paths'
from /Users/bruce/.rvm/gems/ruby-2.3.1@global/gems/railties-5.0.0/lib
/rails/application/routes_reloader.rb:40:in `each'
from /Users/bruce/.rvm/gems/ruby-2.3.1@global/gems/railties-5.0.0/lib
/rails/application/routes_reloader.rb:40:in `load_paths'
from /Users/bruce/.rvm/gems/ruby-2.3.1@global/gems/railties-5.0.0/lib
/rails/application/routes_reloader.rb:16:in `reload!'
from /Users/bruce/.rvm/gems/ruby-2.3.1@global/gems/railties-5.0.0/lib
/rails/application/routes_reloader.rb:26:in `block in updater'
from /Users/bruce/.rvm/gems/ruby-2.3.1@global/gems/activesupport-
5.0.0/lib/active_support/file_update_checker.rb:77:in `execute'
from /Users/bruce/.rvm/gems/ruby-2.3.1@global/gems/railties-5.0.0/lib
/rails/application/routes_reloader.rb:27:in `updater'
from /Users/bruce/.rvm/gems/ruby-2.3.1@global/gems/railties-5.0.0/lib
/rails/application/routes_reloader.rb:7:in `execute_if_updated'
from /Users/bruce/.rvm/gems/ruby-2.3.1@global/gems/railties-5.0.0/lib
/rails/application/finisher.rb:119:in `block in module:Finisher'
from /Users/bruce/.rvm/gems/ruby-2.3.1@global/gems/railties-5.0.0/lib
/rails/initializable.rb:30:in `instance_exec'
from /Users/bruce/.rvm/gems/ruby-2.3.1@global/gems/railties-5.0.0/lib
/rails/initializable.rb:30:in `run'
from /Users/bruce/.rvm/gems/ruby-2.3.1@global/gems/railties-5.0.0/lib
/rails/initializable.rb:55:in `block in run_initializers'
from /Users/bruce/.rvm/rubies/ruby-2.3.1/lib/ruby/2.3.0
/tsort.rb:228:in `block in tsort_each'
from /Users/bruce/.rvm/rubies/ruby-2.3.1/lib/ruby/2.3.0
/tsort.rb:350:in `block (2 levels) in each_strongly_connected_component'
from /Users/bruce/.rvm/rubies/ruby-2.3.1/lib/ruby/2.3.0
/tsort.rb:431:in `each_strongly_connected_component_from'
from /Users/bruce/.rvm/rubies/ruby-2.3.1/lib/ruby/2.3.0
/tsort.rb:349:in `block in each_strongly_connected_component'
from /Users/bruce/.rvm/rubies/ruby-2.3.1/lib/ruby/2.3.0
/tsort.rb:347:in `each'
from /Users/bruce/.rvm/rubies/ruby-2.3.1/lib/ruby/2.3.0
/tsort.rb:347:in `call'
from /Users/bruce/.rvm/rubies/ruby-2.3.1/lib/ruby/2.3.0
/tsort.rb:347:in `each_strongly_connected_component'
from /Users/bruce/.rvm/rubies/ruby-2.3.1/lib/ruby/2.3.0
/tsort.rb:226:in `tsort_each'
from /Users/bruce/.rvm/rubies/ruby-2.3.1/lib/ruby/2.3.0
/tsort.rb:205:in `tsort_each'
from /Users/bruce/.rvm/gems/ruby-2.3.1@global/gems/railties-5.0.0/lib
/rails/initializable.rb:54:in `run_initializers'
from /Users/bruce/.rvm/gems/ruby-2.3.1@global/gems/railties-5.0.0/lib
/rails/application.rb:352:in `initialize!'
from /Users/bruce/sea/config/environment.rb:5:in `<top (required)>'
from /Users/bruce/sea/config.ru:3:in `require_relative'
from /Users/bruce/sea/config.ru:3:in `block in <main>'
from /Users/bruce/.rvm/gems/ruby-2.3.1@global/gems/rack-2.0.1/lib
/rack/builder.rb:55:in `instance_eval'
from /Users/bruce/.rvm/gems/ruby-2.3.1@global/gems/rack-2.0.1/lib
/rack/builder.rb:55:in `initialize'
from /Users/bruce/sea/config.ru:in `new'
from /Users/bruce/sea/config.ru:in `<main>'
from /Users/bruce/.rvm/gems/ruby-2.3.1@global/gems/rack-2.0.1/lib
/rack/builder.rb:49:in `eval'
from /Users/bruce/.rvm/gems/ruby-2.3.1@global/gems/rack-2.0.1/lib
/rack/builder.rb:49:in `new_from_string'
from /Users/bruce/.rvm/gems/ruby-2.3.1@global/gems/rack-2.0.1/lib
/rack/builder.rb:40:in `parse_file'
from /Users/bruce/.rvm/gems/ruby-2.3.1@global/gems/rack-2.0.1/lib
/rack/server.rb:318:in `build_app_and_options_from_config'
from /Users/bruce/.rvm/gems/ruby-2.3.1@global/gems/rack-2.0.1/lib
/rack/server.rb:218:in `app'
from /Users/bruce/.rvm/gems/ruby-2.3.1@global/gems/railties-5.0.0/lib
/rails/commands/server.rb:59:in `app'
from /Users/bruce/.rvm/gems/ruby-2.3.1@global/gems/rack-2.0.1/lib
/rack/server.rb:353:in `wrapped_app'
from /Users/bruce/.rvm/gems/ruby-2.3.1@global/gems/railties-5.0.0/lib
/rails/commands/server.rb:124:in `log_to_stdout'
from /Users/bruce/.rvm/gems/ruby-2.3.1@global/gems/railties-5.0.0/lib
/rails/commands/server.rb:77:in `start'
from /Users/bruce/.rvm/gems/ruby-2.3.1@global/gems/railties-5.0.0/lib
/rails/commands/commands_tasks.rb:90:in `block in server'
from /Users/bruce/.rvm/gems/ruby-2.3.1@global/gems/railties-5.0.0/lib
/rails/commands/commands_tasks.rb:85:in `tap'
from /Users/bruce/.rvm/gems/ruby-2.3.1@global/gems/railties-5.0.0/lib
/rails/commands/commands_tasks.rb:85:in `server'
from /Users/bruce/.rvm/gems/ruby-2.3.1@global/gems/railties-5.0.0/lib
/rails/commands/commands_tasks.rb:49:in `run_command!'
from /Users/bruce/.rvm/gems/ruby-2.3.1@global/gems/railties-5.0.0/lib
/rails/commands.rb:18:in `<top (required)>'
from /Users/bruce/sea/bin/rails:9:in `require'
from /Users/bruce/sea/bin/rails:9:in `<top (required)>'
from /Users/bruce/.rvm/gems/ruby-2.3.1@global/gems/spring-1.7.2/lib
/spring/client/rails.rb:28:in `load'
from /Users/bruce/.rvm/gems/ruby-2.3.1@global/gems/spring-1.7.2/lib
/spring/client/rails.rb:28:in `call'
from /Users/bruce/.rvm/gems/ruby-2.3.1@global/gems/spring-1.7.2/lib
/spring/client/command.rb:7:in `call'
from /Users/bruce/.rvm/gems/ruby-2.3.1@global/gems/spring-1.7.2/lib
/spring/client.rb:30:in `run'
from /Users/bruce/.rvm/gems/ruby-2.3.1@global/gems/spring-1.7.2/bin
/spring:49:in `<top (required)>'
from /Users/bruce/.rvm/gems/ruby-2.3.1@global/gems/spring-1.7.2/lib
/spring/binstub.rb:11:in `load'
from /Users/bruce/.rvm/gems/ruby-2.3.1@global/gems/spring-1.7.2/lib
/spring/binstub.rb:11:in `<top (required)>'
from /Users/bruce/sea/bin/spring:13:in `require'
from /Users/bruce/sea/bin/spring:13:in `<top (required)>'
from bin/rails:3:in `load'`enter
from bin/rails:3:in `<main>'
Seems like in your routes.rb file you are mistakenly have root
. Try change it to root_url
. In ruby if nothing is find in any location then it's show no method error for mainObject which is a base class.
Hope this help you.