Skip to content

Instantly share code, notes, and snippets.

@arkiver
Last active December 31, 2015 19:59
Show Gist options
  • Save arkiver/8037427 to your computer and use it in GitHub Desktop.
Save arkiver/8037427 to your computer and use it in GitHub Desktop.
(rdb:1) @filter
{:grid_id=>8, :from=>Mon, 16 Dec 2013 10:27:58 UTC +00:00, :to=>Tue, 24 Dec 2013 10:27:58 UTC +00:00, :completed=>false}
(rdb:1) @filter[:completed].present?
false
(rdb:1) @filter[:to].present?
true
(rdb:1)
# Rails source of present?
# https://github.com/rails/rails/blob/master/activesupport/lib/active_support/core_ext/object/blank.rb#L19
# An object is present if it's not <tt>blank?</tt>.
def present?
!blank?
end
# An object is blank if it's false, empty, or a whitespace string.
@filter.key?(:completed) instead ?
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment