Grayson Piercee | 4 Jul 05:27

conditions either null or real value


if my category_id could be either nil or a int value, how can I specify
a condition that handles both?

conditions => ["parent_id = ?",params[:category_id]]
conditions => ["parent_id is ?",params[:category_id]]

I'm using acts_as_tree which meets the root levels have no parent_id
(null in SQL)
so if no category_id is passed as a parameter I want it to pull up the
roots, if one is passed, I want it to pull the children of that node.
--

-- 
Posted via http://www.ruby-forum.com/.


Gmane