Class: GeoMasterJp::Station
- Inherits:
-
ActiveRecord::Base
- Object
- ActiveRecord::Base
- GeoMasterJp::Station
- Defined in:
- app/models/geo_master_jp/station.rb
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.inherited(child) ⇒ Object
24 25 26 27 28 29 30 31 32 33 |
# File 'app/models/geo_master_jp/station.rb', line 24 def self.inherited(child) child.belongs_to :line, class_name: GeoMasterJp.config.alternative_class_name(:line), foreign_key: :geo_master_jp_line_code, primary_key: :code child.has_many :same_stations, class_name: GeoMasterJp.config.alternative_class_name(:station), foreign_key: :group_code, primary_key: :group_code if GeoMasterJp.config.use_models.include?(:area) child.belongs_to :prefecture, class_name: GeoMasterJp.config.alternative_class_name(:prefecture), foreign_key: :geo_master_jp_prefecture_code, primary_key: :code end super end |
.select_options(transactions = nil) ⇒ Object
35 36 37 |
# File 'app/models/geo_master_jp/station.rb', line 35 def self.(transactions=nil) (transactions || all).map{|station| [station.name, line.code] } end |
Instance Method Details
#neighbor_station_codes ⇒ Object
20 21 22 |
# File 'app/models/geo_master_jp/station.rb', line 20 def neighbor_station_codes station_connections.pluck(:geo_master_jp_station_2_code) end |