hi,
yesterday i ran into an interesting problem which is im sure a silly
mistake.
do models contain any logic?
for example in my class sale i have this function
define get_category(category)
if category == 0
Sale.find_by_sql(“Select * from Sales WHERE sale_id = ?”,
category)
end
if category != 0
Sale.find_by_sql(“Select * from Sales”)
end
end
however this was not working when displaying data in my view. i tried
all variations of statements but no luck. When i put the if logic into
my controller and just created the same if statement in there, i had no
problem getting the data.
so i was thinking that if there is logic in a model class, than that
would take away from the controllers powers. is this true?
Thanks,