instance method
presence_in
Ruby on Rails 8.0.4
Since v4.1.16Signature
presence_in(another_object)
Returns the receiver if it’s included in the argument otherwise returns nil. Argument must be any object which responds to #include?. Usage:
params[:bucket_type].presence_in %w( project calendar )
This will throw an ArgumentError if the argument doesn’t respond to #include?.
@return [Object]
Parameters
-
another_objectreq
Source
# File activesupport/lib/active_support/core_ext/object/inclusion.rb, line 34
def presence_in(another_object)
in?(another_object) ? self : nil
end
Defined in activesupport/lib/active_support/core_ext/object/inclusion.rb line 34
· View on GitHub
· Improve this page
· Find usages on GitHub
Defined in Object