0
votes

I'm learning ruby on rails. wile building a small app, server was disconnected and won't connect again.

Using:

rails server

I am in the app directory.(double, triple checked...).

connecting to the server was working perfectly for a while then just stopped.

I'm Using Mysql.

Rails server starts perfectly fine on other apps I'm working on.

those are my versions:

root@R://# ruby --version
ruby 2.2.2p95 (2015-04-13 revision 50295) [x86_64-linux]
root@R://# rails -v
Rails 4.2.1

and mysql version:

+-------------------------+-------------------------+ | Variable_name | Value | +-------------------------+-------------------------+ | innodb_version | 5.5.43 | | protocol_version | 10 | | slave_type_conversions | | | version | 5.5.43-0ubuntu0.14.04.1 | | version_comment | (Ubuntu) | | version_compile_machine | x86_64 | | version_compile_os | debian-linux-gnu | +-------------------------+-------------------------+

this is the output for

rails server

root@R://home/ruby/Projects/SempleApp# rails server => Booting WEBrick => Rails 4.2.1 application starting in development on http://localhost:3000 => Runrails server -hfor more startup options => Ctrl-C to shutdown server Exiting

my database.yml file is set ok and i did not changed it since the server was connecting.

I restarted Mysql service. Restarted the terminal and restarted the whole computer.. and this app still cannot connect to the server Other apps can..

I'm stuck... can't find answer anywhere. Help...

PS- This is my first Q in here. Hope I gave the right info.

Thanks

Full error:

root@ruby-man://home/ruby/Projects/TweetrWork# rails server => Booting WEBrick => Rails 4.2.1 application starting in development on http://localhost:3000 => Run rails server -h for more startup options => Ctrl-C to shutdown server Exiting /home/ruby/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/activesupport-4.2.1/lib/active_support/dependencies.rb:268:in load': /home/ruby/Projects/TweetrWork/config/routes.rb:60: syntax error, unexpected end-of-input, expecting keyword_end (SyntaxError) from /home/ruby/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/activesupport-4.2.1/lib/active_support/dependencies.rb:268:inblock in load' from /home/ruby/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/activesupport-4.2.1/lib/active_support/dependencies.rb:240:in load_dependency' from /home/ruby/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/activesupport-4.2.1/lib/active_support/dependencies.rb:268:inload' from /home/ruby/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/railties-4.2.1/lib/rails/application/routes_reloader.rb:40:in block in load_paths' from /home/ruby/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/railties-4.2.1/lib/rails/application/routes_reloader.rb:40:ineach' from /home/ruby/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/railties-4.2.1/lib/rails/application/routes_reloader.rb:40:in load_paths' from /home/ruby/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/railties-4.2.1/lib/rails/application/routes_reloader.rb:16:inreload!' from /home/ruby/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/railties-4.2.1/lib/rails/application/routes_reloader.rb:26:in block in updater' from /home/ruby/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/activesupport-4.2.1/lib/active_support/file_update_checker.rb:75:incall' from /home/ruby/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/activesupport-4.2.1/lib/active_support/file_update_checker.rb:75:in execute' from /home/ruby/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/railties-4.2.1/lib/rails/application/routes_reloader.rb:27:inupdater' from /home/ruby/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/railties-4.2.1/lib/rails/application/routes_reloader.rb:7:in execute_if_updated' from /home/ruby/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/railties-4.2.1/lib/rails/application/finisher.rb:69:inblock in ' from /home/ruby/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/railties-4.2.1/lib/rails/initializable.rb:30:in instance_exec' from /home/ruby/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/railties-4.2.1/lib/rails/initializable.rb:30:inrun' from /home/ruby/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/railties-4.2.1/lib/rails/initializable.rb:55:in block in run_initializers' from /home/ruby/.rbenv/versions/2.2.2/lib/ruby/2.2.0/tsort.rb:226:inblock in tsort_each' from /home/ruby/.rbenv/versions/2.2.2/lib/ruby/2.2.0/tsort.rb:348:in block (2 levels) in each_strongly_connected_component' from /home/ruby/.rbenv/versions/2.2.2/lib/ruby/2.2.0/tsort.rb:429:ineach_strongly_connected_component_from' from /home/ruby/.rbenv/versions/2.2.2/lib/ruby/2.2.0/tsort.rb:347:in block in each_strongly_connected_component' from /home/ruby/.rbenv/versions/2.2.2/lib/ruby/2.2.0/tsort.rb:345:ineach' from /home/ruby/.rbenv/versions/2.2.2/lib/ruby/2.2.0/tsort.rb:345:in call' from /home/ruby/.rbenv/versions/2.2.2/lib/ruby/2.2.0/tsort.rb:345:ineach_strongly_connected_component' from /home/ruby/.rbenv/versions/2.2.2/lib/ruby/2.2.0/tsort.rb:224:in tsort_each' from /home/ruby/.rbenv/versions/2.2.2/lib/ruby/2.2.0/tsort.rb:203:intsort_each' from /home/ruby/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/railties-4.2.1/lib/rails/initializable.rb:54:in run_initializers' from /home/ruby/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/railties-4.2.1/lib/rails/application.rb:352:ininitialize!' from /home/ruby/Projects/TweetrWork/config/environment.rb:5:in <top (required)>' from /home/ruby/Projects/TweetrWork/config.ru:3:inrequire' from /home/ruby/Projects/TweetrWork/config.ru:3:in block in <main>' from /home/ruby/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/rack-1.6.4/lib/rack/builder.rb:55:ininstance_eval' from /home/ruby/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/rack-1.6.4/lib/rack/builder.rb:55:in initialize' from /home/ruby/Projects/TweetrWork/config.ru:innew' from /home/ruby/Projects/TweetrWork/config.ru:in <main>' from /home/ruby/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/rack-1.6.4/lib/rack/builder.rb:49:ineval' from /home/ruby/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/rack-1.6.4/lib/rack/builder.rb:49:in new_from_string' from /home/ruby/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/rack-1.6.4/lib/rack/builder.rb:40:inparse_file' from /home/ruby/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/rack-1.6.4/lib/rack/server.rb:299:in build_app_and_options_from_config' from /home/ruby/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/rack-1.6.4/lib/rack/server.rb:208:inapp' from /home/ruby/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/railties-4.2.1/lib/rails/commands/server.rb:61:in app' from /home/ruby/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/rack-1.6.4/lib/rack/server.rb:336:inwrapped_app' from /home/ruby/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/railties-4.2.1/lib/rails/commands/server.rb:139:in log_to_stdout' from /home/ruby/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/railties-4.2.1/lib/rails/commands/server.rb:78:instart' from /home/ruby/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/railties-4.2.1/lib/rails/commands/commands_tasks.rb:80:in block in server' from /home/ruby/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/railties-4.2.1/lib/rails/commands/commands_tasks.rb:75:intap' from /home/ruby/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/railties-4.2.1/lib/rails/commands/commands_tasks.rb:75:in server' from /home/ruby/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/railties-4.2.1/lib/rails/commands/commands_tasks.rb:39:inrun_command!' from /home/ruby/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/railties-4.2.1/lib/rails/commands.rb:17:in <top (required)>' from /home/ruby/Projects/TweetrWork/bin/rails:8:inrequire' from /home/ruby/Projects/TweetrWork/bin/rails:8:in <top (required)>' from /home/ruby/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/spring-1.3.6/lib/spring/client/rails.rb:28:inload' from /home/ruby/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/spring-1.3.6/lib/spring/client/rails.rb:28:in call' from /home/ruby/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/spring-1.3.6/lib/spring/client/command.rb:7:incall' from /home/ruby/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/spring-1.3.6/lib/spring/client.rb:26:in run' from /home/ruby/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/spring-1.3.6/bin/spring:48:in' from /home/ruby/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/spring-1.3.6/lib/spring/binstub.rb:11:in load' from /home/ruby/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/spring-1.3.6/lib/spring/binstub.rb:11:in' from /home/ruby/.rbenv/versions/2.2.2/lib/ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in require' from /home/ruby/.rbenv/versions/2.2.2/lib/ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:inrequire' from /home/ruby/Projects/TweetrWork/bin/spring:13:in <top (required)>' from bin/rails:3:inload' from bin/rails:3:in `'

1
What happens when you do rails dbconsoleOjash
goes into console perfectly..Eli
Could you post the error you are getting while running rails sOjash
I updated the Q with the full error..Eli
In TweetrWork/config/routes.rb file you are missing the end keyword, please add it and restart with rails sPrashant4224

1 Answers

0
votes

The answer is here:

4.2.1/lib/active_support/dependencies.rb:268:in load': /home/ruby/Projects/TweetrWork/config/routes.rb:60: syntax error, unexpected end-of-input, **expecting keyword_end (SyntaxError)**

This is a typo in your code. As written by Prashant4224 adding end at the right place in /home/ruby/Projects/TweetrWork/config/routes.rb should fix the problem