среда, ноября 08, 2006

ActiveRecord added support for nil and Array in :conditions

Nice feature added to rails several days ago

Support nil and Array in :conditions => { attr => value } hashes. #6548 [Assaf, Jeremy Kemper]
find(:all, :conditions => { :topic_id => [1, 2, 3], :last_read => nil }


So for Todo.find(:all, :conditions => { :id => [1,2,3] })
will be generated following query
SELECT * FROM todos WHERE (todos.`id` IN (1,2,3))

And Todo.find(:all, :conditions => { :description => nil }) will use
SELECT * FROM todos WHERE (todos.`description` IS NULL)

Комментарии: 0:

Отправить комментарий

Подпишитесь на каналы Комментарии к сообщению [Atom]

<< Главная страница