I'm in a find routine, and I don't want to perform the search if one of the arguments is nil. What is the recommendation from the group?
I started to use "assert_not_nil" but that is not defined in my Model chain.
Thanks, Jason
I'm in a find routine, and I don't want to perform the search if one of the arguments is nil. What is the recommendation from the group?
I started to use "assert_not_nil" but that is not defined in my Model chain.
Thanks, Jason
return unless myvalue
=)
How about:
return unless arguments.all?
'arguments.all?' will return true if and only if none of the collection members is false or nil.
If an argument can be false, you could do this:
return unless arguments.all? { |arg| !arg.nil? }
Regards, Andy Stewart
Hello Jason,
Thanks guys, you hit both questions (fail loudly and fail silently)...