Module: ActiveRecordNullObject::NullObject

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

Instance Method Summary collapse

Instance Method Details

#empty?Boolean

Returns:

  • (Boolean)


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

def empty?
  true
end

#idObject



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

def id 
  nil
end

#nil?Boolean

Returns:

  • (Boolean)


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

def nil?
  true
end

#unsavableObject



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

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