Search code examples
hashruby-on-rails-4hashrocket

How to force Rails 4 to use old-style hash syntax


I've just upgraded an old project to Rails 4 and I've just realized that it has upgrade the schema.rb using the new-style hash syntax. I suppose Rails is gonna use this syntax for all its generators.

How can I, friendly, say to Rails that I prefer the old-style syntax for hashes?


Solution

  • schema.rb is created by rake db:migrate command. As per my knowledge, it will be hard to suggest the old-style syntax for hashes to Rails. BUT nothing is impossible, you can play around with rails/activerecord/lib/active_record/schema_dumper.rb file. The only problem is when you upgrade the rails gem next time it will override.

    This old-style syntax to new-style syntax for hashes was done in Dump schema using new style hash commit.