Sha256: 49e7de2b89a2e655c8a89a39b3554a39f942139366dc6198552e7cee07a4556f

Contents?: true

Size: 617 Bytes

Versions: 1

Compression:

Stored size: 617 Bytes

Contents

class Designation < ActiveRecord::Base

  self.table_name = "designations"
  self.primary_key = 'id'

  has_many :agent_designations, :inverse_of => :designation

  def name
    designation
  end

  # Get All Designations
  def self.get_all_designations
    Hash[*Designation.pluck(:id, :designation).flatten]
  end

  # Get Agent's designations
  def self.get_agent_designations(agent)
    Hash[*AgentDesignation.where(agent_id: agent.id).joins(:designation).pluck(:designation_id, :designation).flatten]
  end

  #rails_admin do 

    #configure :agent_designations do
      #visible(false)
    #end
    
  #end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
civic311_test3-0.0.2 app/models/designation.rb