user1420228
user1420228

Reputation: 11

Ruby 1.9+ style hash syntax doesn't work

I'm running ruby 1.9.3p194 (2012-04-20 revision 35410) [x86_64-darwin11.4.0] on my macbook.

Yet, when I attempt to use "new style" hashes such as:

stylesheet_link_tag "application", media: "all"

I get an error that reads "unexpected: expecting )"

I can fix this issue by replacing with the "old style" hashrockets:

stylesheet_link_tag "application", :media => "all"

I'm trying to figure out why rails isn't allowing the new style of ruby hashes. Any help would be greatly appreciated.

Upvotes: 1

Views: 836

Answers (2)

jstrong
jstrong

Reputation: 1607

Try putting this in your .bash_profile (or bashrc or whatever you are using):

[[ -s "$HOME/.rvm/scripts/rvm" ]] && . "$HOME/.rvm/scripts/rvm" # Load RVM function

After that, of course, issue the source command then:

rvm use 1.9.2
rvm info

Which should work and display all the information about the current ruby version and gemset. The new hash syntax failing because you are not actually running ruby 1.9.3. Doing "ruby -v" should confirm the problem. Given your comment above, you rvm has to be a function in order for it to work.

Also, What operating system are you running?

Upvotes: 0

DVG
DVG

Reputation: 17480

Sounds like rails is running under system ruby while you have RVM installed as 1.9.3 (I would guess)

Try

$ rvm --default use 1.9.3

Then reset your console and do

$ ruby -v

to double check

Upvotes: 4

Related Questions