Module: ActiveRecordNullObject::NullObject

Extended by:
ActiveSupport::Concern
Defined in:
lib/activerecord_null_object/null_object.rb

Instance Method Summary collapse

Instance Method Details

#blank?Boolean

Returns:

  • (Boolean)


23
24
25
# File 'lib/activerecord_null_object/null_object.rb', line 23

def blank?
  true
end

#empty?Boolean

Returns:

  • (Boolean)


19
20
21
# File 'lib/activerecord_null_object/null_object.rb', line 19

def empty?
  true
end

#idObject



11
12
13
# File 'lib/activerecord_null_object/null_object.rb', line 11

def id
  nil
end

#nil?Boolean

Returns:

  • (Boolean)


15
16
17
# File 'lib/activerecord_null_object/null_object.rb', line 15

def nil?
  true
end

#present?Boolean

Returns:

  • (Boolean)


27
28
29
# File 'lib/activerecord_null_object/null_object.rb', line 27

def present?
  false
end

#unsavableObject



31
32
33
# File 'lib/activerecord_null_object/null_object.rb', line 31

def unsavable
  errors.add(:base, "is a null object and can't be saved")
end