Forum: Ruby on Rails WHERE NOT syntax with ActiveRecord

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
Fd17e0a67191e9e72df285e1b8e4c2fb?d=identicon&s=25 Will Clark (willclarkdesigns)
on 2007-05-02 06:05
I need to run a sql statement along the lines of SELECT * FROM items
WHERE NOT ... But I would like to run this in the ActiveRecord syntax. I
like using :conditions => [...] but obviously where it renders 'WHERE
NOT' and not simply 'WHERE'. I'd rather not use find_by_sql if at all
possible for security reasons. Anyone know how to do this?

8bc543795b502900b5333aea73ad5533?d=identicon&s=25 Eden Li (edenli)
on 2007-05-02 06:23
(Received via mailing list)
Model.find(:all, :conditions => ['NOT column = ?', var])

On May 2, 12:05 pm, Will Clark <>
Fd17e0a67191e9e72df285e1b8e4c2fb?d=identicon&s=25 Will Clark (willclarkdesigns)
on 2007-05-08 00:12
Thanks Eden.
This topic is locked and can not be replied to.