aboutsummaryrefslogtreecommitdiffstats
path: root/app/models/chouette/pt_link.rb
diff options
context:
space:
mode:
Diffstat (limited to 'app/models/chouette/pt_link.rb')
-rw-r--r--app/models/chouette/pt_link.rb48
1 files changed, 24 insertions, 24 deletions
diff --git a/app/models/chouette/pt_link.rb b/app/models/chouette/pt_link.rb
index 8a4e368ea..5bf77da02 100644
--- a/app/models/chouette/pt_link.rb
+++ b/app/models/chouette/pt_link.rb
@@ -1,37 +1,37 @@
require 'geokit'
-class Chouette::PtLink < Chouette::ActiveRecord
- # FIXME http://jira.codehaus.org/browse/JRUBY-6358
- self.primary_key = "id"
+module Chouette
+ class PtLink < Chouette::ActiveRecord
+ # FIXME http://jira.codehaus.org/browse/JRUBY-6358
+ self.primary_key = "id"
- include Geokit::Mappable
+ include Geokit::Mappable
- def geometry
- the_geom
- end
+ def geometry
+ the_geom
+ end
- def self.import_csv
- csv_file = Rails.root + "chouette_pt_links.csv"
- if File.exists?( csv_file)
- csv = CSV::Reader.parse(File.read(csv_file))
+ def self.import_csv
+ csv_file = Rails.root + "chouette_pt_links.csv"
+ if File.exists?( csv_file)
+ csv = CSV::Reader.parse(File.read(csv_file))
- slug = csv.shift.first
+ slug = csv.shift.first
- Network::Base.find_by_slug( slug).tune_connection
+ Network::Base.find_by_slug( slug).tune_connection
- csv.each do |row|
- origin = Chouette::StopArea.find_by_objectid( row[0])
- destination = Chouette::StopArea.find_by_objectid( row[1])
+ csv.each do |row|
+ origin = Chouette::StopArea.find_by_objectid( row[0])
+ destination = Chouette::StopArea.find_by_objectid( row[1])
- raise "unknown origin #{row[0]}" unless origin
- raise "unknown destination #{row[1]}" unless destination
+ raise "unknown origin #{row[0]}" unless origin
+ raise "unknown destination #{row[1]}" unless destination
- Chouette::PtLink.create( :departure_id => origin.id,
- :arrival_id => destination.id,
- :the_geom => GeoRuby::SimpleFeatures::Geometry.from_hex_ewkb( row[2]))
+ Chouette::PtLink.create( :departure_id => origin.id,
+ :arrival_id => destination.id,
+ :the_geom => GeoRuby::SimpleFeatures::Geometry.from_hex_ewkb( row[2]))
+ end
end
end
-
end
-
-end
+end \ No newline at end of file