ruby - Is there a Rails equivalent to PHP's isset()? -
basically check make sure url param set. how i'd in php:
if(isset($_post['foo']) && isset($_post['bar'])){}
is rough/best equivalent isset() in ror?
if(!params['foo'].nil? && !params['bar'].nil?) end
the closer match #present?
# returns true if not nil , not blank params['foo'].present?
there few other methods
# returns true if nil params['foo'].nil? # returns true if nil or empty params['foo'].blank?
Comments
Post a Comment