Friday, May 21, 2010

When frameworks do fail use sexy sql

Imagine this scenario : is x AM in the morning your preferred framework model is starting to fail (Ruby On Snails )
Active Record model stinks when you start using multi monster joins so you got to stick with the old sql skills
something like ActiveRecord::Base.connection.select_all("select id from restaurants order by popularity limit 100")



and this will help even when at the same time when heroku rake db:migrate fails
what to do ?
$heroku console 
and start writing sexy sql statements like
>> ActiveRecord::Base.connection.select_all("ALTER TABLE xxx ADD COLUMN xxx_id integer")
>> ActiveRecord::Base.connection.select_all("select xxx_id from xxx order by xxx_id limit 100")

No comments: