new-style hash argument available error in Ruby 1.9.3 - ruby-on-rails

I just moved a project to another server and seem to be having problems related to the new new hash argument available since Ruby 1.9.2. When I run rails s I get the following error
Exiting
/usr/lib/ruby/gems/1.8/gems/activesupport-3.1.1/lib/active_support/dependencies.rb:234:in `load': /var/www/myapp/config/initializers/session_store.rb:3: syntax error, unexpected ':', expecting $end (SyntaxError) ...sion_store :cookie_store, key: '_myapp_session'
^
from /usr/lib/ruby/gems/1.8/gems/activesupport-3.1.1/lib/active_support/dependencies.rb:234:in `load'
from /usr/lib/ruby/gems/1.8/gems/activesupport-3.1.1/lib/active_support/dependencies.rb:223:in `load_dependency'
from /usr/lib/ruby/gems/1.8/gems/activesupport-3.1.1/lib/active_support/dependencies.rb:640:in `new_constants_in'
from /usr/lib/ruby/gems/1.8/gems/activesupport-3.1.1/lib/active_support/dependencies.rb:223:in `load_dependency'
from /usr/lib/ruby/gems/1.8/gems/activesupport-3.1.1/lib/active_support/dependencies.rb:234:in `load'
from /usr/lib/ruby/gems/1.8/gems/railties-3.1.1/lib/rails/engine.rb:556
from /usr/lib/ruby/gems/1.8/gems/railties-3.1.1/lib/rails/engine.rb:555:in `each'
from /usr/lib/ruby/gems/1.8/gems/railties-3.1.1/lib/rails/engine.rb:555
from /usr/lib/ruby/gems/1.8/gems/railties-3.1.1/lib/rails/initializable.rb:30:in `instance_exec'
from /usr/lib/ruby/gems/1.8/gems/railties-3.1.1/lib/rails/initializable.rb:30:in `run'
from /usr/lib/ruby/gems/1.8/gems/railties-3.1.1/lib/rails/initializable.rb:55:in `run_initializers'
from /usr/lib/ruby/gems/1.8/gems/railties-3.1.1/lib/rails/initializable.rb:54:in `each'
from /usr/lib/ruby/gems/1.8/gems/railties-3.1.1/lib/rails/initializable.rb:54:in `run_initializers'
from /usr/lib/ruby/gems/1.8/gems/railties-3.1.1/lib/rails/application.rb:96:in `initialize!'
from /usr/lib/ruby/gems/1.8/gems/railties-3.1.1/lib/rails/railtie/configurable.rb:30:in `send'
from /usr/lib/ruby/gems/1.8/gems/railties-3.1.1/lib/rails/railtie/configurable.rb:30:in `method_missing'
from /var/www/myapp/config/environment.rb:5
from /usr/lib/ruby/gems/1.8/gems/activesupport-3.1.1/lib/active_support/dependencies.rb:240:in `require'
from /usr/lib/ruby/gems/1.8/gems/activesupport-3.1.1/lib/active_support/dependencies.rb:240:in `require'
from /usr/lib/ruby/gems/1.8/gems/activesupport-3.1.1/lib/active_support/dependencies.rb:223:in `load_dependency'
from /usr/lib/ruby/gems/1.8/gems/activesupport-3.1.1/lib/active_support/dependencies.rb:640:in `new_constants_in'
from /usr/lib/ruby/gems/1.8/gems/activesupport-3.1.1/lib/active_support/dependencies.rb:223:in `load_dependency'
from /usr/lib/ruby/gems/1.8/gems/activesupport-3.1.1/lib/active_support/dependencies.rb:240:in `require'
from /var/www/myapp/config.ru:4
from /usr/lib/ruby/gems/1.8/gems/rack-1.3.4/lib/rack/builder.rb:51:in `instance_eval'
from /usr/lib/ruby/gems/1.8/gems/rack-1.3.4/lib/rack/builder.rb:51:in `initialize'
from /var/www/myapp/config.ru:1:in `new'
from /var/www/myapp/config.ru:1
The Error is referencing the following line
Myapp::Application.config.session_store :cookie_store, key: '_myapp_session'
I really don't think the above line of code is the issue. If I remove key: '_myapp_session' or revert it back to the Ruby 1.8.X style I just get the next hash argument error.
I the server I moved to originally had Ruby 1.8.7 running on the server. I have updated ruby to 1.9.3. When I run ruby -v I get ruby 1.9.3p0 (2011-10-30 revision 33570) [x86_64-linux]
I'm not sure why I'm still having the hash issue. Has anyone ran into similar problems?

You may need to check paths, it appears that it is using the rails executable from the 1.8 ruby tree. When you upgrade, you may need to reinstall gems.. This situation is one reason rvm is the preferred way to install ruby.

you should post the code you're suspecting guilty, it's hard to answer with so little clue.
One gotcha about the new style is that you can only use it if ALL the keys on your hash are symbols, this may be the problem.

Related

Error while starting rails server : code&.downcase AND region&.upcase

I am working on a Ruby on Rails project. I have everything set up but when I am trying to start the server by doing "rails s" I am getting the following error:
/home/syed/Desktop/offerletter/vendor/bundle/ruby/2.2.0/gems/browser-5.1.0/lib/browser/browser.rb:9:in `require_relative': /home/syed/Desktop/offerletter/vendor/bundle/ruby/2.2.0/gems/browser-5.1.0/lib/browser/accept_language.rb:37: syntax error, unexpected '.' (SyntaxError)
code&.downcase
^
/home/syed/Desktop/offerletter/vendor/bundle/ruby/2.2.0/gems/browser-5.1.0/lib/browser/accept_language.rb:44: syntax error, unexpected '.'
region&.upcase
^
from /home/syed/Desktop/offerletter/vendor/bundle/ruby/2.2.0/gems/browser-5.1.0/lib/browser/browser.rb:9:in `<top (required)>'
from /home/syed/Desktop/offerletter/vendor/bundle/ruby/2.2.0/gems/browser-5.1.0/lib/browser.rb:3:in `require_relative'
from /home/syed/Desktop/offerletter/vendor/bundle/ruby/2.2.0/gems/browser-5.1.0/lib/browser.rb:3:in `<top (required)>'
from /usr/share/rvm/rubies/ruby-2.2.2/lib/ruby/site_ruby/2.2.0/bundler/runtime.rb:81:in `require'
from /usr/share/rvm/rubies/ruby-2.2.2/lib/ruby/site_ruby/2.2.0/bundler/runtime.rb:81:in `block (2 levels) in require'
from /usr/share/rvm/rubies/ruby-2.2.2/lib/ruby/site_ruby/2.2.0/bundler/runtime.rb:76:in `each'
from /usr/share/rvm/rubies/ruby-2.2.2/lib/ruby/site_ruby/2.2.0/bundler/runtime.rb:76:in `block in require'
from /usr/share/rvm/rubies/ruby-2.2.2/lib/ruby/site_ruby/2.2.0/bundler/runtime.rb:65:in `each'
from /usr/share/rvm/rubies/ruby-2.2.2/lib/ruby/site_ruby/2.2.0/bundler/runtime.rb:65:in `require'
from /usr/share/rvm/rubies/ruby-2.2.2/lib/ruby/site_ruby/2.2.0/bundler.rb:114:in `require'
from /home/syed/Desktop/offerletter/config/application.rb:9:in `<top (required)>'
from /home/syed/Desktop/offerletter/vendor/bundle/ruby/2.2.0/gems/railties-4.2.2/lib/rails/commands/commands_tasks.rb:78:in `require'
from /home/syed/Desktop/offerletter/vendor/bundle/ruby/2.2.0/gems/railties-4.2.2/lib/rails/commands/commands_tasks.rb:78:in `block in server'
from /home/syed/Desktop/offerletter/vendor/bundle/ruby/2.2.0/gems/railties-4.2.2/lib/rails/commands/commands_tasks.rb:75:in `tap'
from /home/syed/Desktop/offerletter/vendor/bundle/ruby/2.2.0/gems/railties-4.2.2/lib/rails/commands/commands_tasks.rb:75:in `server'
from /home/syed/Desktop/offerletter/vendor/bundle/ruby/2.2.0/gems/railties-4.2.2/lib/rails/commands/commands_tasks.rb:39:in `run_command!'
from /home/syed/Desktop/offerletter/vendor/bundle/ruby/2.2.0/gems/railties-4.2.2/lib/rails/commands.rb:17:in `<top (required)>'
from bin/rails:4:in `require'
from bin/rails:4:in `<main>'
Things thats I have tried:
bundle install
bundle update
1.Ubuntu version - 20.4 LTS
2.rails - 4.2.2 (have to maintain this version due to various reasons)
3.ruby - 2.2.2 (have to maintain this version due to various reasons)
Note: Please ask in comments section If you need any futher information from me to solve the issue.
Kindly please help.
The safe navigator (&.) was introduced in Ruby 2.3.0, and you're using Ruby 2.2.0.
Please use try method or upgrade the Ruby version to 2.3.0+ for using safe navigator.
If the version of Ruby you're forced to use is too old for the safe navigator (&.) you can go oldschool with
code.downcase if code
or use the try() method

Error when run server rails 2.3.5 with memcached

I use ruby version 1.8.7, gem version 1.3.5, rails version 2.3.5 and memcache. I get this error when I run server
phuongnm-lap:~/trunk/hurricane$ ruby script/server
=> Booting Mongrel
=> Rails 2.3.5 application starting on http://0.0.0.0:3000
/home/asiantech/.rvm/gems/ruby-1.8.7-p374/gems/bundler-1.11.2/lib/bundler/runtime.rb:77:in `require': /home/asiantech/trunk/hurricane/vendor/bundle/ruby/1.8/gems/get_process_mem-0.2.0/lib/get_process_mem.rb:60: undefined (?...) sequence: /(?<value>(\d*\.{0,1}\d+))\s+(?<unit>\w\w)/ (SyntaxError)
from /home/asiantech/.rvm/gems/ruby-1.8.7-p374/gems/bundler-1.11.2/lib/bundler/runtime.rb:77:in `require'
from /home/asiantech/.rvm/gems/ruby-1.8.7-p374/gems/bundler-1.11.2/lib/bundler/runtime.rb:72:in `each'
from /home/asiantech/.rvm/gems/ruby-1.8.7-p374/gems/bundler-1.11.2/lib/bundler/runtime.rb:72:in `require'
from /home/asiantech/.rvm/gems/ruby-1.8.7-p374/gems/bundler-1.11.2/lib/bundler/runtime.rb:61:in `each'
from /home/asiantech/.rvm/gems/ruby-1.8.7-p374/gems/bundler-1.11.2/lib/bundler/runtime.rb:61:in `require'
from /home/asiantech/.rvm/gems/ruby-1.8.7-p374/gems/bundler-1.11.2/lib/bundler.rb:99:in `require'
from ./script/../config/boot.rb:41:in `load_gems'
from /home/asiantech/trunk/hurricane/vendor/bundle/ruby/1.8/gems/rails-2.3.5/lib/initializer.rb:164:in `process'
from /home/asiantech/trunk/hurricane/vendor/bundle/ruby/1.8/gems/rails-2.3.5/lib/initializer.rb:113:in `send'
from /home/asiantech/trunk/hurricane/vendor/bundle/ruby/1.8/gems/rails-2.3.5/lib/initializer.rb:113:in `run'
from /home/asiantech/trunk/hurricane/config/environment.rb:34
from /home/asiantech/trunk/hurricane/vendor/bundle/ruby/1.8/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:156:in `require'
from /home/asiantech/trunk/hurricane/vendor/bundle/ruby/1.8/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:156:in `require'
from /home/asiantech/trunk/hurricane/vendor/bundle/ruby/1.8/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:521:in `new_constants_in'
from /home/asiantech/trunk/hurricane/vendor/bundle/ruby/1.8/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:156:in `require'
from /home/asiantech/trunk/hurricane/vendor/bundle/ruby/1.8/gems/rails-2.3.5/lib/commands/server.rb:84
from script/server:3:in `require'
from script/server:3
please help me!
Your ruby version is too old for the get_process_mem gem to run. The gem uses a complex regular expression to parse information from /proc files on your linux server. However, ruby 1.8.7 does not support such complex regexp yet.
You can see for yourself in irb. In ruby 1.8.7 the match fails:
"aaa" =~ /(?<value>(\d*\.{0,1}\d+))\s+(?<unit>\w\w)/
# => SyntaxError: compile error
# => (irb):1: undefined (?...) sequence: /(?<value>(\d*\.{0,1}\d+))\s+(?<unit>\w\w)/
whereas under ruby 2.2 it works ok (does not return anything in this test case, but more importantly, does not fail with error):
"aaa" =~ /(?<value>(\d*\.{0,1}\d+))\s+(?<unit>\w\w)/
# => nil
You have a few options now:
Upgrade to a newer ruby (and rails) if you can, you won't have to solve these elderly code-related problems and won't be using an unsupported ruby/rails version any more, but nevertheless this is rather a cumbersome process.
Get rid of the get_process_mem gem. You can see the same info, i.e. the memory consumed by the process, using command line utilities, without needing to install any gem. Try the top or htop commands for example.

Testing older Rails app: circular argument reference warning, cannot load test/unit/assertions

CentOS-6.6
ruby 2.2.0p0 (2014-12-25 revision 49005) [x86_64-linux-gnu]
Bundler version 1.7.11
I am attempting to patch a older RoR application that was upgraded to 4.0.1 last year. When I run bundle exec cucumber before making any changes I now get this sort of error:
bundle exec cucumber
/home/byrnejb/Projects/Software/theHeart/code/hll_th_forex_rss/libexec/bundler/lib/ruby/2.2.0/gems/activesupport-4.0.1/lib/active_support/values/time_zone.rb:282: warning: circular argument reference - now
cannot load such file -- test/unit/assertions (LoadError)
/home/byrnejb/Projects/Software/theHeart/code/hll_th_forex_rss/libexec/bundler/lib/ruby/2.2.0/gems/activesupport-4.0.1/lib/active_support/dependencies.rb:229:in `require'
/home/byrnejb/Projects/Software/theHeart/code/hll_th_forex_rss/libexec/bundler/lib/ruby/2.2.0/gems/activesupport-4.0.1/lib/active_support/dependencies.rb:229:in `block in require'
/home/byrnejb/Projects/Software/theHeart/code/hll_th_forex_rss/libexec/bundler/lib/ruby/2.2.0/gems/activesupport-4.0.1/lib/active_support/dependencies.rb:214:in `load_dependency'
/home/byrnejb/Projects/Software/theHeart/code/hll_th_forex_rss/libexec/bundler/lib/ruby/2.2.0/gems/activesupport-4.0.1/lib/active_support/dependencies.rb:229:in `require'
/home/byrnejb/Projects/Software/theHeart/code/hll_th_forex_rss/features/support/local_env.rb:5:in `<top (required)>'
/home/byrnejb/Projects/Software/theHeart/code/hll_th_forex_rss/libexec/bundler/lib/ruby/2.2.0/gems/activesupport-4.0.1/lib/active_support/dependencies.rb:223:in `load'
/home/byrnejb/Projects/Software/theHeart/code/hll_th_forex_rss/libexec/bundler/lib/ruby/2.2.0/gems/activesupport-4.0.1/lib/active_support/dependencies.rb:223:in `block in load'
/home/byrnejb/Projects/Software/theHeart/code/hll_th_forex_rss/libexec/bundler/lib/ruby/2.2.0/gems/activesupport-4.0.1/lib/active_support/dependencies.rb:214:in `load_dependency'
/home/byrnejb/Projects/Software/theHeart/code/hll_th_forex_rss/libexec/bundler/lib/ruby/2.2.0/gems/activesupport-4.0.1/lib/active_support/dependencies.rb:223:in `load'
/home/byrnejb/Projects/Software/theHeart/code/hll_th_forex_rss/libexec/bundler/lib/ruby/2.2.0/gems/cucumber-1.3.19/lib/cucumber/rb_support/rb_language.rb:95:in `load_code_file'
/home/byrnejb/Projects/Software/theHeart/code/hll_th_forex_rss/libexec/bundler/lib/ruby/2.2.0/gems/cucumber-1.3.19/lib/cucumber/runtime/support_code.rb:180:in `load_file'
/home/byrnejb/Projects/Software/theHeart/code/hll_th_forex_rss/libexec/bundler/lib/ruby/2.2.0/gems/cucumber-1.3.19/lib/cucumber/runtime/support_code.rb:83:in `block in load_files!'
/home/byrnejb/Projects/Software/theHeart/code/hll_th_forex_rss/libexec/bundler/lib/ruby/2.2.0/gems/cucumber-1.3.19/lib/cucumber/runtime/support_code.rb:82:in `each'
/home/byrnejb/Projects/Software/theHeart/code/hll_th_forex_rss/libexec/bundler/lib/ruby/2.2.0/gems/cucumber-1.3.19/lib/cucumber/runtime/support_code.rb:82:in `load_files!'
/home/byrnejb/Projects/Software/theHeart/code/hll_th_forex_rss/libexec/bundler/lib/ruby/2.2.0/gems/cucumber-1.3.19/lib/cucumber/runtime.rb:184:in `load_step_definitions'
/home/byrnejb/Projects/Software/theHeart/code/hll_th_forex_rss/libexec/bundler/lib/ruby/2.2.0/gems/cucumber-1.3.19/lib/cucumber/runtime.rb:42:in `run!'
/home/byrnejb/Projects/Software/theHeart/code/hll_th_forex_rss/libexec/bundler/lib/ruby/2.2.0/gems/cucumber-1.3.19/lib/cucumber/cli/main.rb:47:in `execute!'
/home/byrnejb/Projects/Software/theHeart/code/hll_th_forex_rss/libexec/bundler/lib/ruby/2.2.0/gems/cucumber-1.3.19/bin/cucumber:13:in `<top (required)>'
/home/byrnejb/Projects/Software/theHeart/code/hll_th_forex_rss/libexec/bundler/lib/ruby/2.2.0/bin/cucumber:23:in `load'
/home/byrnejb/Projects/Software/theHeart/code/hll_th_forex_rss/libexec/bundler/lib/ruby/2.2.0/bin/cucumber:23:in `<main>'
warning: circular argument reference - xxxx was limited to Cucumber, which formerly was at 1.3.10. So I updated cucumber to 1.3.19. Now I am getting the error in active support. Has anyone else seen this.
I had a problem with Minitest preventing this project from advancing to RoR-4.1 back last spring. I do not know if this is pertinent or not but I include it for completeness.
In any case, who puts testing dependencies into distributed runtime code? Why is activesupport complaining about 'test/unit/assertions'?
Try upgrading from Rails 4.0.1 to 4.0.13
If that doesn't work, try using Ruby 2.1.5 to see if you get the same error message. I bet some gem you're using is running into this issue with Ruby 2.2. Example 1, Example 2. Example 3 from Rails.
The long term solution is to use Ruby 2.2 compatible gems, but by switching to 2.1.5 temporarily, you may be able to solve the problem in the short term and narrow down the specific gem versions that are causing the error.
i just add gem 'test-unit' in Gemfile and run 'bundle install' again. It is solved to me.

'Rails' with Activesupport 3.2.0

I'm a new user of Ruby on rails and I try now to create my owen blog to practice this beautiful framework.
So, after I did this commande to start server I got this error , and I thought that from ActiveSupport.
I need a help :)
The is the message error that I got :
~/Bureau/blog$ rails server
=> Booting WEBrick
=> Rails 3.2.0.rc2 application starting in development on http://0.0.0.0:3000
=> Call with -d to detach
=> Ctrl-C to shutdown server
Exiting
/usr/lib/ruby/gems/1.8/gems/activesupport-3.2.0.rc2/lib/active_support/dependencies.rb:245:in `load': /home/eayoub/Bureau/blog/config/initializers/session_store.rb:3: syntax error, unexpected ':', expecting $end (SyntaxError)
...sion_store :cookie_store, key: '_blog_session'
^
from /usr/lib/ruby/gems/1.8/gems/activesupport-3.2.0.rc2/lib/active_support/dependencies.rb:245:in `load'
from /usr/lib/ruby/gems/1.8/gems/activesupport-3.2.0.rc2/lib/active_support/dependencies.rb:236:in `load_dependency'
from /usr/lib/ruby/gems/1.8/gems/activesupport-3.2.0.rc2/lib/active_support/dependencies.rb:245:in `load'
from /usr/lib/ruby/gems/1.8/gems/railties-3.2.0.rc2/lib/rails/engine.rb:588
from /usr/lib/ruby/gems/1.8/gems/railties-3.2.0.rc2/lib/rails/engine.rb:587:in `each'
from /usr/lib/ruby/gems/1.8/gems/railties-3.2.0.rc2/lib/rails/engine.rb:587
from /usr/lib/ruby/gems/1.8/gems/railties-3.2.0.rc2/lib/rails/initializable.rb:30:in `instance_exec'
from /usr/lib/ruby/gems/1.8/gems/railties-3.2.0.rc2/lib/rails/initializable.rb:30:in `run'
from /usr/lib/ruby/gems/1.8/gems/railties-3.2.0.rc2/lib/rails/initializable.rb:55:in `run_initializers'
from /usr/lib/ruby/gems/1.8/gems/railties-3.2.0.rc2/lib/rails/initializable.rb:54:in `each'
from /usr/lib/ruby/gems/1.8/gems/railties-3.2.0.rc2/lib/rails/initializable.rb:54:in `run_initializers'
from /usr/lib/ruby/gems/1.8/gems/railties-3.2.0.rc2/lib/rails/application.rb:136:in `initialize!'
from /usr/lib/ruby/gems/1.8/gems/railties-3.2.0.rc2/lib/rails/railtie/configurable.rb:30:in `send'
from /usr/lib/ruby/gems/1.8/gems/railties-3.2.0.rc2/lib/rails/railtie/configurable.rb:30:in `method_missing'
from /home/eayoub/Bureau/blog/config/environment.rb:5
from /home/eayoub/Bureau/blog/config.ru:4:in `require'
from /home/eayoub/Bureau/blog/config.ru:4
from /usr/lib/ruby/gems/1.8/gems/rack-1.4.0/lib/rack/builder.rb:51:in `instance_eval'
from /usr/lib/ruby/gems/1.8/gems/rack-1.4.0/lib/rack/builder.rb:51:in `initialize'
from /home/eayoub/Bureau/blog/config.ru:1:in `new'
from /home/eayoub/Bureau/blog/config.ru:1
Looks like you are running on Ruby 1.8.7, but the code you have written is only valid in Ruby 1.9.
If possible, I would recommend upgrading up to 1.9.3; that should fix the issue.
If you cannot use Ruby 1.9.3, just change the line from
key: '_blog_session'
to
:key=>'_blog_session'
Are you running Ruby 1.9.x? The error is on a line using the new 1.9 hash syntax which is not backwards compatible. Try running ruby --v and seeing what version you're running. If its a 1.8.x you'll need to upgrade Ruby in order to run the latest version of Rails.

What’s wrong with my local Rails environment?

There is a Rails application I started a full year ago. It’s a Rails 2.3 app.
Now, someone else has made remote changes (it’s on Github, sorry, but it’s private). And I have done
sudo gem update
that is, updated all my gems, including Rails (to 3).
Realizing this, I have done
rake:freeze:edge RELEASE=2.3.8
or whatever to make this release use that version of rails, hoping this was the solution.
however, no such luck so far.
I get errors trying to start the server, AND trying to run script/console (though it’s more successful).
Note that this exact application works just fine on EngineYard.
Server:
$ script/server
=> Booting Mongrel
=> Rails 2.3.8 application starting on http://0.0.0.0:3000
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/yaml.rb:133:in `load': syntax error on line 45, col 3: `' (ArgumentError)
from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/yaml.rb:133:in `load'
from /Users/ajh/Sites/PROJECT_NAME/config/../vendor/rails/railties/lib/initializer.rb:902:in `database_configuration'
from /Users/ajh/Sites/PROJECT_NAME/config/../vendor/rails/railties/lib/initializer.rb:437:in `initialize_database'
from /Users/ajh/Sites/PROJECT_NAME/config/../vendor/rails/railties/lib/initializer.rb:141:in `process'
from /Users/ajh/Sites/PROJECT_NAME/config/../vendor/rails/railties/lib/initializer.rb:113:in `send'
from /Users/ajh/Sites/PROJECT_NAME/config/../vendor/rails/railties/lib/initializer.rb:113:in `run'
from /Users/ajh/Sites/PROJECT_NAME/config/environment.rb:11
from /Library/Ruby/Site/1.8/rubygems/custom_require.rb:31:in `gem_original_require'
from /Library/Ruby/Site/1.8/rubygems/custom_require.rb:31:in `require'
from /Users/ajh/Sites/PROJECT_NAME/vendor/rails/activesupport/lib/active_support/dependencies.rb:156:in `require'
from /Users/ajh/Sites/PROJECT_NAME/vendor/rails/activesupport/lib/active_support/dependencies.rb:521:in `new_constants_in'
from /Users/ajh/Sites/PROJECT_NAME/vendor/rails/activesupport/lib/active_support/dependencies.rb:156:in `require'
from /Users/ajh/Sites/PROJECT_NAME/vendor/rails/railties/lib/commands/server.rb:84
from /Library/Ruby/Site/1.8/rubygems/custom_require.rb:31:in `gem_original_require'
from /Library/Ruby/Site/1.8/rubygems/custom_require.rb:31:in `require'
from script/server:3
Console:
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/yaml.rb:133:in load':ArgumentError: syntax error on line 45, col 3:rai'
And when, in console, I try to use a defined model:
#mm = MyModel.find(:all)
NameError: uninitialized constant MyModel
from /Users/ajh/Sites/PROJECT_NAME/vendor/rails/activesupport/lib/active_support/dependencies.rb:443:in load_missing_constant'
from /Users/ajh/Sites/PROJECT_NAME/vendor/rails/activesupport/lib/active_support/dependencies.rb:80:inconst_missing'
from /Users/ajh/Sites/PROJECT_NAME/vendor/rails/activesupport/lib/active_support/dependencies.rb:92:in `const_missing'
from (irb):1
I just had this error, and the problem turned out to be that I'd used a tab instead of a double-space in the database.yml file. Thought I'd mention it, in case others have the same trouble.
My database.yml had a stray end keyword. Cleaning up that file solved my problems. Thanks to Garrett for pointing me in the right direction!

Resources