lundi 21 mars 2016

Is there a way to automatically update old Ruby on Rails queries to the newer syntax?

For example, update something from Rails 2 like

Model.find(:first, :conditions => ["column_a = ? and column_b = ?", 'string', object.id])

to a newer method that works such as

Model.where(column_a: 'string', column_b: object.id).first

I have a project where I need to update about a thousand more of these things than I originally thought. But I can't find any kind of gem, app, anything that can do these automatically. And it seems that with so many Rails apps upgrades someone would have. Anybody know of anything that can automate this process?

Aucun commentaire:

Enregistrer un commentaire