Speaking of custom find methods. I ran into an interesting bug today that
although isnt really a Rails bug is something that was hard to find
I had a call something along the lines of
WorkItem.find_all_by_type_cd_and_employee(types, employee)
where type is an array and employee is not
what i got back was weird
types = [''type1'', ''type2'']
employee_id=3
what effectively happens is i get a query something along the lines of
select * from work_item where type_cd = ''type1'' and
employee_id=0
because ''type2'' evaluates to integer 0.
It was hard to locate because the code looked reasonable.
What do people think of this? Am I just stupid or is this a reasonable "Be
aware" kind of thing?
Mark
_______________________________________________
Rails mailing list
Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org
http://lists.rubyonrails.org/mailman/listinfo/rails