Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

I am getting the following error when trying to start my Rails application in production for the first time:

/var/www/railsapp/config/initializers/session_store.rb:3: syntax error, unexpected ':', expecting $end ...sion_store :cookie_store, key: '_intranet_session' ^

I have read that this could be an issue with the current ruby version, so I installed RVM and updated the running version.

**root@rails ~#** ruby -v
ruby 1.8.7 (2010-04-19 patchlevel 253) [i686-linux], MBARI 0x8770, Ruby Enterprise Edition 2010.02
**root@rails ~#** rvm use 1.9.3
Using /usr/local/rvm/gems/ruby-1.9.3-p125
**root@rails ~#** ruby -v
ruby 1.9.3p125 (2012-02-16 revision 34643) [i686-linux]

I notice that the production version of Ruby is 1.9.3p125 but the development version is 1.9.3p0, not sure if that matters.

I then double checked the Rails version was the correct one:

**root@rails www/railsapp#** rails -v
Rails 3.1.4

I thought it would be worth restarting the server and then the application just for giggles but that didn't help either.

When reading a few other questions I noticed that if RVM isn't installed then running 'rvm list known' would fail, so I tested it:

**root@rails www/railsapp#** rvm list known
# MRI Rubies
[ruby-]1.8.6[-p420]
[ruby-]1.8.7[-p358]
[ruby-]1.8.7-head
[ruby-]1.9.1[-p431]
[ruby-]1.9.2-p180
[ruby-]1.9.2-p290
[ruby-]1.9.2[-p318]
[ruby-]1.9.2-head
[ruby-]1.9.3-preview1
[ruby-]1.9.3-rc1
[ruby-]1.9.3-p0
[ruby-]1.9.3[-p125]
[ruby-]1.9.3-head
ruby-head

# GoRuby
goruby

# TheCodeShop - MRI experimental patches
tcs

# JRuby
jruby-1.2.0
jruby-1.3.1
jruby-1.4.0
jruby-1.6.5
/usr/local/rvm/config/known

If it helps I am running the Turnkey Linux Rails appliance (TurnKey Linux 11.3 / Ubuntu 10.04 Lucid LTS).

I'm at a bit of a dead end of what to try, and advice would be greatly appreciated!

share|improve this question
    
    
Thanks Adam, I've added a file called .rvmrc with 'rvm ruby 1.9.3' and restarted the application. No joy :( –  dannymcc Mar 9 '12 at 22:03
    
Rails 3.1 might not support ruby 1.9.3 , try 1.9.2 and see if you get the same error. –  Ryan Gibbons Mar 9 '12 at 22:06
    
Didn't seem to make a different Ryan, ran 'rvm use 1.9.2' and checked it was loaded then restarted the application. No joy. –  dannymcc Mar 9 '12 at 22:12
1  
What does line 3 of /var/www/railsapp/config/initializers/session_store.rb say? Did you start the app with the right environment, e.g., RAILS_ENV=production or something like that? –  cjc Mar 10 '12 at 0:32

2 Answers 2

up vote 1 down vote accepted

The problem is with the system environment.

What everyone failed to ask (including myself) was to see the full error logs. Doing so revealed he was using Passenger and it was loading the gem from 1.8.

More investigation shows RVM was loading as a system-wide install. So setting 1.9.3 as the system default and then re-install the passenger gem, then installing the apache2 module, then updating the apache configs fixed the issue.

This this box is dedicated for that one app, the above fix shouldn't be a problem. If you end up running more rails apps and need a more tightly defined environments, then read through this documentation http://beginrescueend.com/integration/passenger/. This will let you create a gemset for each app. I'm not sure how it will work with different ruby versions, as passenger will still have to be loaded from a single ruby install, but it might be able to run the scripts as a different ruby version?

share|improve this answer

I think you have a syntax error in your session_store.rb.

Take a look at the example here.

So, you probably want something like this instead of what you have:

Intranet::Application.config.session_store :cookie_store, :key => '_intranet_session'
share|improve this answer
    
After changing that line I get a new error: /var/www/railsapp/config/initializers/wrap_parameters.rb:8: syntax error, unexpected ':', expecting kEND wrap_parameters format: [:json] ^ –  dannymcc Mar 10 '12 at 13:38
    
Gist of wrap_parameters.rb gist.github.com/2011440 –  dannymcc Mar 10 '12 at 13:39
    
Hmm, no idea. You might want to post over at StackOverflow instead of ServerFault. This is a Ruby syntax issue, not something having to do with servers, networks, etc. –  cjc Mar 10 '12 at 13:52
    
Any way of migrating a question? Or delete and re-post? –  dannymcc Mar 10 '12 at 14:32
    
I can vote to close, but that requires others to also do the same. It might be faster/cleaner to delete and repost –  cjc Mar 10 '12 at 14:38

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.