# But in SQL fragments, especially in conditions fragments (:conditions => "..."), the connection.execute()
# or Model.find_by_sql() methods, it has to be applied manually. Instead of passing a string to the conditions
...

Ruby On ActiveRecord find_by_sql

by David, January 18, 2010 21:24

I thought that the ["?", va...

D41d8cd98f00b204e9800998ecf8427e Talk

Ruby On ActiveRecord find_by_sql

by David, January 18, 2010 16:10

Thanks. Updated now.

D41d8cd98f00b204e9800998ecf8427e Talk
Clip.find_by_sql(["select * from clips where not exists
        (select 'clip_id' from histories where histories.clip_id = clips.id
        and histories.user_id = ?) ORDER BY clips.created_at DESC LIMIT 20", user.id])

Ruby ActiveRecord find_by_sql

by David, January 17, 2010 20:52, 5 refactorings, tagged with rails, sql, short, ruby, activerecord

How can I turn this into so...

D41d8cd98f00b204e9800998ecf8427e Talk