is there any better way to write that :
if !params[:qaddress].nil?
cond_b = EZ::Where::Condition.new :properties do
…
end
end
using a do… unless ? something like that ??
cond_b = EZ::Where::Condition.new :properties do
...
end unless params[:qaddress].nil?
how about:
unless params[:qaddress].nil?
cond_b = EZ::Where::Condition.new :properties do
…
end
end
Yeah it only gets rid of the if!, but I think it’s more readable
Kev
On 18.09.2006 12:11, Kevin J. wrote:
how about:
unless params[:qaddress].nil?
cond_b = EZ::Where::Condition.new :properties do
…
end
end
Maybe this (untested):
params[:qaddress] and
cond_b = EZ::Where::Condition.new :properties do
…
end
Kind regards
robert
On 9/18/06, Robert K. [email protected] wrote:
Maybe this (untested):
params[:qaddress] and
Would work if nil were the only thing evaluating to false, but there are
certain instances of the FalseClass, you know
cond_b = EZ::Where::Condition.new :properties do
...
end
Kind regards
robert
idem
–
Deux choses sont infinies : l’univers et la bêtise humaine ; en ce qui
concerne l’univers, je n’en ai pas acquis la certitude absolue.
Josselin wrote:
cond_b = EZ::Where::Condition.new :properties do
...
end unless params[:qaddress].nil?
Well, the unless modifier works here – if qaddress is nil, cond_b is
set to nil. Here’s another way:
cond_b = if params[:qaddress]
EZ::Where::Condition.new :properties do
…
end
end
Fnord