Module: KirguduRefs::ModelBasicProperties::StateID

Included in:
Finances::Bank, Globe::City, Globe::Country, Globe::Region
Defined in:
app/helpers/kirgudu_refs/model_basic_properties.rb

Defined Under Namespace

Modules: InstanceMethods

Class Method Summary collapse

Class Method Details

.included(base) ⇒ Object



106
107
108
109
110
111
112
113
# File 'app/helpers/kirgudu_refs/model_basic_properties.rb', line 106

def self.included(base)
  base.belongs_to :state, class_name: ::KirguduRefs::Globe::State, foreign_key: :state_id
  base.scope :by_state, lambda { |value| base.where(state_id: value) if value }

  base.class_eval do
    include InstanceMethods
  end
end