1
2
3
# 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...

Avatar Talk

Ruby On ActiveRecord find_by_sql

by David, January 18, 2010 16:10

Thanks. Updated now.

Avatar Talk
1
2
3
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 activerecord, rails, ruby, sql, short

How can I turn this into so...

Avatar Talk