instance method attribute_present?

Ruby on Rails 2.3.18

Since v2.2.3 Last seen in v3.1.12

Available in: v2.2.3 v2.3.18 v3.0.20 v3.1.12

Signature

attribute_present?(attribute)

Returns true if the specified attribute has been set by the user or by a database load and is neither nil nor empty? (the latter only applies to objects that respond to empty?, most notably Strings).

Parameters

attribute req
Source
# File activerecord/lib/active_record/base.rb, line 2840
      def attribute_present?(attribute)
        value = read_attribute(attribute)
        !value.blank?
      end

Defined in activerecord/lib/active_record/base.rb line 2840 · View on GitHub · Improve this page · Find usages on GitHub

Defined in ActiveRecord::Base

Type at least 2 characters to search.

↑↓ navigate · open · esc close