Hello everyone,
As a beginner to ROR, I am very confused regarding why the following
is happening.
If my function is defined as
def self.home_categories (portal_id)
find(:all, :conditions => [ "portal_id=?", portal_id ] )
end
the following doesn’t works (the database is queried with a value of
0.
portal_id=1
@categories = Category.home_categories (:portal_id)
but this works
@categories = Category.home_categories (1)
However,
If my function is defined as
def self.home_categories (portal_id)
find(:all, :conditions => "portal_id=#{portal_id}" )
end
then the following works
portal_id=1
@categories = Category.home_categories (portal_id)
and the following also works:
@categories = Category.home_categories (1)
Why is that happening? Any pointers / explanation is appreciated.
Thanks
Frank
P.S. Thank you Ezra for your assistance with my earlier question and
clarifying how I accidentally hijacked the thread. My sincerest
apologies to the list members and the thread owner for the accidental
hijack.