Module: HasModerated::Associations::HasOne::AssociationHelpers

Defined in:
lib/has_moderated/associations/has_one.rb

Class Method Summary collapse

Class Method Details

.add_assoc_to_record(*args) ⇒ Object



46
47
48
49
# File 'lib/has_moderated/associations/has_one.rb', line 46

def self.add_assoc_to_record(*args)
  # same as HasMany
  HasModerated::Associations::Collection::AssociationHelpers::add_assoc_to_record(*args)
end

.delete_assoc_from_record(from, assoc_id, reflection) ⇒ Object



51
52
53
54
# File 'lib/has_moderated/associations/has_one.rb', line 51

def self.delete_assoc_from_record(from, assoc_id, reflection)
  from.send("#{reflection.name}=", nil)
  from.save # TODO necessary?
end