Sha256: efe47a6c3f5a81c30595deac2244a13462c9c38f4e1909f9d592e758ce94b68c
Contents?: true
Size: 935 Bytes
Versions: 7
Compression:
Stored size: 935 Bytes
Contents
require 'yaml' module ChangeManager class Change < ActiveRecord::Base validates :change_type, :owner, :target, presence: true def self.new_change(owner, change_type, context, target, cancelled = false) # needs a spec # create object in db # return object id foo = self.create({ owner: owner, change_type: change_type, context: context, target: target, cancelled: cancelled }) foo.id end def cancel self.cancelled = true self.save end def cancelled? self.cancelled end def inverse_of?(possible_inverse_change) is_inverse = false @change_types ||= YAML.load_file(File.join(ChangeManager::Engine.root, 'config/change_types.yaml')) if self.change_type == @change_types[possible_inverse_change.change_type]['inverse'] is_inverse = true end return is_inverse end end end
Version data entries
7 entries across 7 versions & 1 rubygems