My server wont start,ruby on rails mac -


blockquote

when try run bin/rails server,my server wont start display connection errors or whatever.i tried bundle exec rails server didnt work either.

warning: you're using rubygems 2.0.14 spring. upgrade @ least rubygems 2.1.0 , run `gem pristine --all` better startup performance. => booting webrick => rails 4.2.1 application starting in development on http://localhost:3000 => run `rails server -h` more startup options => ctrl-c shutdown server exiting /users/i/blog/config/routes.rb:7:in `<top (required)>': undefined method `resources' main:object (nomethoderror)     /library/ruby/gems/2.0.0/gems/activesupport-4.2.1/lib/active_support/dependencies.rb:268:in `load'     /library/ruby/gems/2.0.0/gems/activesupport-4.2.1/lib/active_support/dependencies.rb:268:in `block in load'     /library/ruby/gems/2.0.0/gems/activesupport-4.2.1/lib/active_support/dependencies.rb:240:in `load_dependency'     /library/ruby/gems/2.0.0/gems/activesupport-4.2.1/lib/active_support/dependencies.rb:268:in `load'     /library/ruby/gems/2.0.0/gems/railties-4.2.1/lib/rails/application/routes_reloader.rb:40:in `block in load_paths'     /library/ruby/gems/2.0.0/gems/railties-4.2.1/lib/rails/application/routes_reloader.rb:40:in `each'     /library/ruby/gems/2.0.0/gems/railties-4.2.1/lib/rails/application/routes_reloader.rb:40:in `load_paths'     /library/ruby/gems/2.0.0/gems/railties-4.2.1/lib/rails/application/routes_reloader.rb:16:in `reload!'     /library/ruby/gems/2.0.0/gems/railties-4.2.1/lib/rails/application/routes_reloader.rb:26:in `block in updater'     /library/ruby/gems/2.0.0/gems/activesupport-4.2.1/lib/active_support/file_update_checker.rb:75:in `call'     /library/ruby/gems/2.0.0/gems/activesupport-4.2.1/lib/active_support/file_update_checker.rb:75:in `execute'     /library/ruby/gems/2.0.0/gems/railties-4.2.1/lib/rails/application/routes_reloader.rb:27:in `updater'     /library/ruby/gems/2.0.0/gems/railties-4.2.1/lib/rails/application/routes_reloader.rb:7:in `execute_if_updated'     /library/ruby/gems/2.0.0/gems/railties-4.2.1/lib/rails/application/finisher.rb:69:in `block in <module:finisher>'     /library/ruby/gems/2.0.0/gems/railties-4.2.1/lib/rails/initializable.rb:30:in `instance_exec'     /library/ruby/gems/2.0.0/gems/railties-4.2.1/lib/rails/initializable.rb:30:in `run'     /library/ruby/gems/2.0.0/gems/railties-4.2.1/lib/rails/initializable.rb:55:in `block in run_initializers'     /system/library/frameworks/ruby.framework/versions/2.0/usr/lib/ruby/2.0.0/tsort.rb:150:in `block in tsort_each'     /system/library/frameworks/ruby.framework/versions/2.0/usr/lib/ruby/2.0.0/tsort.rb:183:in `block (2 levels) in each_strongly_connected_component'     /system/library/frameworks/ruby.framework/versions/2.0/usr/lib/ruby/2.0.0/tsort.rb:219:in `each_strongly_connected_component_from'     /system/library/frameworks/ruby.framework/versions/2.0/usr/lib/ruby/2.0.0/tsort.rb:182:in `block in each_strongly_connected_component'     /system/library/frameworks/ruby.framework/versions/2.0/usr/lib/ruby/2.0.0/tsort.rb:180:in `each'     /system/library/frameworks/ruby.framework/versions/2.0/usr/lib/ruby/2.0.0/tsort.rb:180:in `each_strongly_connected_component'     /system/library/frameworks/ruby.framework/versions/2.0/usr/lib/ruby/2.0.0/tsort.rb:148:in `tsort_each'     /library/ruby/gems/2.0.0/gems/railties-4.2.1/lib/rails/initializable.rb:54:in `run_initializers'     /library/ruby/gems/2.0.0/gems/railties-4.2.1/lib/rails/application.rb:352:in `initialize!'     /users/i/blog/config/environment.rb:5:in `<top (required)>'     /users/i/blog/config.ru:3:in `require'     /users/i/blog/config.ru:3:in `block in <main>'     /library/ruby/gems/2.0.0/gems/rack-1.6.0/lib/rack/builder.rb:55:in `instance_eval'     /library/ruby/gems/2.0.0/gems/rack-1.6.0/lib/rack/builder.rb:55:in `initialize'     /users/i/blog/config.ru:in `new'     /users/i/blog/config.ru:in `<main>'     /library/ruby/gems/2.0.0/gems/rack-1.6.0/lib/rack/builder.rb:49:in `eval'     /library/ruby/gems/2.0.0/gems/rack-1.6.0/lib/rack/builder.rb:49:in `new_from_string'     /library/ruby/gems/2.0.0/gems/rack-1.6.0/lib/rack/builder.rb:40:in `parse_file'     /library/ruby/gems/2.0.0/gems/rack-1.6.0/lib/rack/server.rb:299:in `build_app_and_options_from_config'     /library/ruby/gems/2.0.0/gems/rack-1.6.0/lib/rack/server.rb:208:in `app'     /library/ruby/gems/2.0.0/gems/railties-4.2.1/lib/rails/commands/server.rb:61:in `app'     /library/ruby/gems/2.0.0/gems/rack-1.6.0/lib/rack/server.rb:336:in `wrapped_app'     /library/ruby/gems/2.0.0/gems/railties-4.2.1/lib/rails/commands/server.rb:139:in `log_to_stdout'     /library/ruby/gems/2.0.0/gems/railties-4.2.1/lib/rails/commands/server.rb:78:in `start'     /library/ruby/gems/2.0.0/gems/railties-4.2.1/lib/rails/commands/commands_tasks.rb:80:in `block in server'     /library/ruby/gems/2.0.0/gems/railties-4.2.1/lib/rails/commands/commands_tasks.rb:75:in `tap'     /library/ruby/gems/2.0.0/gems/railties-4.2.1/lib/rails/commands/commands_tasks.rb:75:in `server'     /library/ruby/gems/2.0.0/gems/railties-4.2.1/lib/rails/commands/commands_tasks.rb:39:in `run_command!'     /library/ruby/gems/2.0.0/gems/railties-4.2.1/lib/rails/commands.rb:17:in `<top (required)>'     /users/i/blog/bin/rails:8:in `require'     /users/i/blog/bin/rails:8:in `<top (required)>'     /library/ruby/gems/2.0.0/gems/spring-1.3.3/lib/spring/client/rails.rb:27:in `load'     /library/ruby/gems/2.0.0/gems/spring-1.3.3/lib/spring/client/rails.rb:27:in `call'     /library/ruby/gems/2.0.0/gems/spring-1.3.3/lib/spring/client/command.rb:7:in `call'     /library/ruby/gems/2.0.0/gems/spring-1.3.3/lib/spring/client.rb:26:in `run'     /library/ruby/gems/2.0.0/gems/spring-1.3.3/bin/spring:48:in `<top (required)>'     /library/ruby/gems/2.0.0/gems/spring-1.3.3/lib/spring/binstub.rb:11:in `load'     /library/ruby/gems/2.0.0/gems/spring-1.3.3/lib/spring/binstub.rb:11:in `<top (required)>'     /system/library/frameworks/ruby.framework/versions/2.0/usr/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:55:in `require'     /system/library/frameworks/ruby.framework/versions/2.0/usr/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:55:in `require'     /users/i/blog/bin/spring:13:in `<top (required)>'     bin/rails:3:in `load'     bin/rails:3:in `<main>' 

heres config/routes file

rails.application.routes.draw resources :articles root 'welcome#index' end
resources :articles do
resources :comments
end

you have read stacktraces top understand wat going on:

warning: you're using rubygems 2.0.14 spring. upgrade @ least rubygems 2.1.0 , run `gem pristine --all` better startup performance. 

this warning, may want fix later. can ignore @ moment, since warning.

=> booting webrick => rails 4.2.1 application starting in development on http://localhost:3000 => run `rails server -h` more startup options => ctrl-c shutdown server 

this default output when rails boots.

but interesting part:

exiting /users/i/blog/config/routes.rb:7:in `<top (required)>': undefined method `resources' main:object (nomethoderror) 

this line tells you have undefined method 'resources' in 7th line (or before line) of config/routes.rb.

the problem caused second resources :articles block not within outer rails.application.routes.draw block. furthermore have 2 resources :articles, need one. copy following version config/routes.rb fix issue:

rails.application.routes.draw    root 'welcome#index'    resources :articles     resources :comments   end  end 

Comments

Popular posts from this blog

google chrome - Developer tools - How to inspect the elements which are added momentarily (by JQuery)? -

angularjs - Showing an empty as first option in select tag -

php - Cloud9 cloud IDE and CakePHP -