Module: ActsAsApprovable::Ownership::InstanceMethods

Defined in:
lib/acts_as_approvable/ownership.rb

Overview

Instance methods for approval ownership.

Instance Method Summary collapse

Instance Method Details

#assign(owner) ⇒ Boolean

Set the owner and save the record.

Returns:

  • (Boolean)

Raises:



45
46
47
48
49
# File 'lib/acts_as_approvable/ownership.rb', line 45

def assign(owner)
  raise ActsAsApprovable::Error::InvalidOwner unless self.class.available_owners.include?(owner)
  self.owner = owner
  save
end

#unassignBoolean

Removed any assigned owner and save the record.

Returns:

  • (Boolean)


55
56
57
58
# File 'lib/acts_as_approvable/ownership.rb', line 55

def unassign
  self.owner = nil
  save
end