module Operations::ActAsOperationable

Public Instance Methods

acts_as_operationable(options={}) click to toggle source
# File lib/operations/act_as_operationable.rb, line 4
def acts_as_operationable(options={})
end
as_json(options={}) click to toggle source
Calls superclass method
# File lib/operations/act_as_operationable.rb, line 22
def as_json(options={})
  super.as_json(options).merge({scope: named_scope, operations: get_operations})
end
get_operations() click to toggle source
# File lib/operations/act_as_operationable.rb, line 8
def get_operations
  unless respond_to?(:operations)
    raise Operations::Errors::NotImplementedError.new(self.class, :operations)
  end
  unless self.operations.nil? || self.operations.class == String
    raise Operations::Errors::InvalidFieldError.new(:operations, self.class, String)
  end
  self.operations.to_s.to_operations
end
named_scope() click to toggle source
# File lib/operations/act_as_operationable.rb, line 18
def named_scope
  Operations.user_role_name_from(role || 2)
end