Module: KirguduRefs::ModelBasicProperties::CityID

Included in:
Finances::Bank, Globe::SubwayLine, Globe::SubwayStation
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



140
141
142
143
144
145
146
147
# File 'app/helpers/kirgudu_refs/model_basic_properties.rb', line 140

def self.included(base)
  base.belongs_to :city, class_name: ::KirguduRefs::Globe::City, foreign_key: :city_id
  base.scope :by_city, lambda { |value| base.where(city_id: value) if value }

  base.class_eval do
    include InstanceMethods
  end
end