class Object
def presence
...becomes:
region = state || country || 'US'
country = params[:country] if params[:country].present?
state = params[:state] if params[:state].present?
HTTP POST/query parameters:
as not present at all. For example, this simplifies a common check for
This is handy for any representation of objects where blank is the same
object.presence is equivalent to object.present? ? object : nil.
Returns object if it's present? otherwise returns +nil+.
def presence self if present? end