Sha256: fa91119d377bb11613a3aa4d90702a255e4cf043e77bd30267e2b4c0ac2cf6e6

Contents?: true

Size: 1.01 KB

Versions: 2

Compression:

Stored size: 1.01 KB

Contents

require 'uuid'

class CompassAeInstance < ActiveRecord::Base
  attr_protected :created_at, :updated_at
  has_tracked_status
  has_many :parties, :through => :compass_ae_instance_party_roles
  has_many :compass_ae_instance_party_roles, :dependent => :destroy do
    def owners
      where('role_type_id = ?', RoleType.compass_ae_instance_owner.id)
    end
  end
  validates :internal_identifier, :presence => {:message => 'internal_identifier cannot be blank'}, :uniqueness => {:case_sensitive => false}

  def installed_engines
    Rails.application.config.erp_base_erp_svcs.compass_ae_engines.map do |compass_ae_engine|
      klass_name = compass_ae_engine.railtie_name.camelize
      {:name => klass_name, :version => ("#{klass_name}::VERSION::STRING".constantize rescue 'N/A')}
    end
  end

  #helpers for guid
  def set_guid(guid)
    self.guid = guid
    self.save
  end

  def get_guid
    self.guid
  end

  def setup_guid
    guid = Digest::SHA1.hexdigest(Time.now.to_s + rand(10000).to_s)
    set_guid(guid)
    guid
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
erp_base_erp_svcs-3.1.5 app/models/compass_ae_instance.rb
erp_base_erp_svcs-3.1.4 app/models/compass_ae_instance.rb