P
Peter Alvin
In general, how do you optionally pass an optional qualifier to a Ruby
def?
For example, for some model in Rails, like this:
MyDBClass.findall, ...
How do I optionally add a condition? This generates a syntax error:
some_test ? :conditions => "id=100" : nil,
I guess it doesn't like that I only want to add the :conditions
occasionally. What is the Ruby best practice or idiom for this?
Pete
def?
For example, for some model in Rails, like this:
MyDBClass.findall, ...
How do I optionally add a condition? This generates a syntax error:
some_test ? :conditions => "id=100" : nil,
I guess it doesn't like that I only want to add the :conditions
occasionally. What is the Ruby best practice or idiom for this?
Pete