Sha256: 8cd03a4911aa71d5d3f54eccc3660ed7cd51f9f6cfd3fface02a0fc2f25fc433

Contents?: true

Size: 731 Bytes

Versions: 4

Compression:

Stored size: 731 Bytes

Contents

# Government Agency 是政府机构。
# function_code 是行政职能代码: PLST: Police Station 公安局, PLSS: Police Sub-Station 派出所
class Unidom::Party::GovernmentAgency < ActiveRecord::Base

  self.table_name = 'unidom_government_agencies'

  include Unidom::Common::Concerns::ModelExtension

  validates :name, presence: true, length: { in: 2..self.columns_hash['name'].limit }

  belongs_to :supervision_region, polymorphic: true

  has_many :source_party_relations, class_name: 'Unidom::Party::PartyRelation', as: :target_party
  has_many :target_party_relations, class_name: 'Unidom::Party::PartyRelation', as: :source_party

  scope :supervision_region_is, ->(region) { where supervision_region: region }

end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
unidom-party-1.0.2 app/models/unidom/party/government_agency.rb
unidom-party-1.0.1 app/models/unidom/party/government_agency.rb
unidom-party-1.0 app/models/unidom/party/government_agency.rb
unidom-party-0.7 app/models/unidom/party/government_agency.rb