kakubei
kakubei

Reputation: 5400

Force Rails to use Ruby 1.8.7 syntax but keep using ruby 1.9.2

I know this sounds strange, but on my development box I can't go back to 1.8.7 because installing Passenger and the Mysql Ruby gem with MAMP was a huge pain in the behind and I don't want to mess with it now that it's working.

However, for deployment, my hosting company has Ruby 1.8.7 so I'm getting some errors with the new syntax that scaffolding creates. So the question is, is it possible to force Rails to use the Ruby 1.8.7 syntax while still using Ruby 1.9.2?

I know it sounds dumb and might not be possible at all, but just wanted to make sure.

Upvotes: 2

Views: 398

Answers (1)

lucapette
lucapette

Reputation: 20724

I think you mean forcing Ruby old style syntax while using generators. Well, there is an option exactly for that:

 [--old-style-hash]                        # Force using old style hash (:foo => 'bar') on Ruby >= 1.9

So you can do the following for example:

rails generate scaffold post title:string content:text --old-style-hash

Upvotes: 5

Related Questions