ninoxe 1.1.5 → 1.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (123) hide show
  1. checksums.yaml +4 -4
  2. data/Rakefile +9 -12
  3. data/app/models/chouette/access_link.rb +52 -51
  4. data/app/models/chouette/access_point.rb +7 -7
  5. data/app/models/chouette/active_record.rb +28 -28
  6. data/app/models/chouette/company.rb +3 -3
  7. data/app/models/chouette/connection_link.rb +3 -3
  8. data/app/models/chouette/footnote.rb +1 -1
  9. data/app/models/chouette/group_of_line.rb +2 -2
  10. data/app/models/chouette/journey_pattern.rb +7 -3
  11. data/app/models/chouette/line.rb +11 -9
  12. data/app/models/chouette/network.rb +2 -2
  13. data/app/models/chouette/pt_link.rb +1 -1
  14. data/app/models/chouette/route.rb +9 -10
  15. data/app/models/chouette/stop_area.rb +8 -8
  16. data/app/models/chouette/stop_point.rb +3 -3
  17. data/app/models/chouette/time_table.rb +25 -122
  18. data/app/models/chouette/time_table_date.rb +1 -1
  19. data/app/models/chouette/time_table_period.rb +1 -1
  20. data/app/models/chouette/vehicle_journey.rb +82 -77
  21. data/app/models/chouette/vehicle_journey_at_stop.rb +1 -1
  22. data/config/database.yml +16 -8
  23. data/config/database.yml.travis +15 -6
  24. data/db/migrate/20150526075108_add_foreign_key_to_routes.rb +28 -0
  25. data/lib/ninoxe/engine.rb +4 -0
  26. data/lib/ninoxe/version.rb +1 -1
  27. data/lib/ninoxe.rb +3 -0
  28. data/spec/dummy/README.rdoc +15 -248
  29. data/spec/dummy/Rakefile +1 -1
  30. data/spec/dummy/app/{mailers/.gitkeep → assets/images/.keep} +0 -0
  31. data/spec/dummy/app/assets/javascripts/application.js +3 -5
  32. data/spec/dummy/app/assets/stylesheets/application.css +1 -1
  33. data/spec/dummy/app/controllers/application_controller.rb +3 -1
  34. data/spec/dummy/app/{models/.gitkeep → controllers/concerns/.keep} +0 -0
  35. data/spec/dummy/{lib/assets/.gitkeep → app/mailers/.keep} +0 -0
  36. data/spec/dummy/{log/.gitkeep → app/models/.keep} +0 -0
  37. data/spec/dummy/app/models/concerns/.keep +0 -0
  38. data/spec/dummy/app/views/layouts/application.html.erb +2 -2
  39. data/spec/dummy/bin/bundle +3 -0
  40. data/spec/dummy/bin/rails +4 -0
  41. data/spec/dummy/bin/rake +4 -0
  42. data/spec/dummy/config/application.rb +8 -36
  43. data/spec/dummy/config/boot.rb +4 -9
  44. data/spec/dummy/config/database.yml +16 -8
  45. data/spec/dummy/config/environment.rb +2 -4
  46. data/spec/dummy/config/environments/development.rb +11 -19
  47. data/spec/dummy/config/environments/production.rb +41 -28
  48. data/spec/dummy/config/environments/test.rb +13 -14
  49. data/spec/dummy/config/initializers/filter_parameter_logging.rb +4 -0
  50. data/spec/dummy/config/initializers/inflections.rb +6 -5
  51. data/spec/dummy/config/initializers/secret_token.rb +7 -2
  52. data/spec/dummy/config/initializers/session_store.rb +1 -6
  53. data/spec/dummy/config/initializers/wrap_parameters.rb +6 -6
  54. data/spec/dummy/config/locales/en.yml +20 -2
  55. data/spec/dummy/config/locales/fr.yml +23 -0
  56. data/spec/dummy/config.ru +1 -1
  57. data/spec/dummy/db/schema.rb +147 -143
  58. data/spec/dummy/lib/assets/.keep +0 -0
  59. data/spec/dummy/log/.keep +0 -0
  60. data/spec/dummy/public/404.html +43 -11
  61. data/spec/dummy/public/422.html +43 -11
  62. data/spec/dummy/public/500.html +43 -11
  63. data/spec/dummy/script/rails +1 -1
  64. data/spec/factories/chouette_access_links.rb +13 -0
  65. data/spec/factories/chouette_access_points.rb +12 -0
  66. data/spec/factories/chouette_companies.rb +9 -0
  67. data/spec/factories/chouette_connection_links.rb +13 -0
  68. data/spec/factories/chouette_footnotes.rb +10 -0
  69. data/spec/factories/chouette_group_of_lines.rb +9 -0
  70. data/spec/factories/chouette_journey_pattern.rb +40 -0
  71. data/spec/factories/chouette_lines.rb +44 -0
  72. data/spec/factories/chouette_networks.rb +9 -0
  73. data/spec/factories/chouette_routes.rb +26 -0
  74. data/spec/factories/chouette_stop_areas.rb +12 -0
  75. data/spec/factories/chouette_stop_points.rb +10 -0
  76. data/spec/factories/chouette_time_table.rb +37 -0
  77. data/spec/factories/chouette_vehicle_journey.rb +66 -0
  78. data/spec/factories/chouette_vehicle_journey_at_stop.rb +8 -0
  79. data/spec/models/chouette/access_link_spec.rb +17 -13
  80. data/spec/models/chouette/access_point_spec.rb +106 -103
  81. data/spec/models/chouette/active_record_spec.rb +57 -57
  82. data/spec/models/chouette/area_type_spec.rb +8 -8
  83. data/spec/models/chouette/company_spec.rb +18 -18
  84. data/spec/models/chouette/connection_link_spec.rb +19 -15
  85. data/spec/models/chouette/direction_spec.rb +8 -8
  86. data/spec/models/chouette/exporter_spec.rb +4 -4
  87. data/spec/models/chouette/file_validator_spec.rb +4 -4
  88. data/spec/models/chouette/footnote_spec.rb +1 -1
  89. data/spec/models/chouette/group_of_line_spec.rb +11 -11
  90. data/spec/models/chouette/journey_pattern_spec.rb +16 -14
  91. data/spec/models/chouette/line_spec.rb +36 -32
  92. data/spec/models/chouette/loader_spec.rb +9 -9
  93. data/spec/models/chouette/network_spec.rb +9 -9
  94. data/spec/models/chouette/object_id_spec.rb +31 -28
  95. data/spec/models/chouette/route_spec.rb +51 -47
  96. data/spec/models/chouette/stop_area_spec.rb +191 -188
  97. data/spec/models/chouette/stop_point_spec.rb +13 -10
  98. data/spec/models/chouette/time_table_period_spec.rb +18 -18
  99. data/spec/models/chouette/time_table_spec.rb +303 -255
  100. data/spec/models/chouette/transport_mode_spec.rb +10 -10
  101. data/spec/models/chouette/trident_active_record_spec.rb +17 -17
  102. data/spec/models/chouette/vehicle_journey_at_stop_spec.rb +13 -12
  103. data/spec/models/chouette/vehicle_journey_spec.rb +46 -46
  104. data/spec/presenters/chouette/geometry/line_presenter_spec.rb +2 -2
  105. data/spec/spec_helper.rb +22 -9
  106. metadata +102 -87
  107. data/config/database.yml.ci +0 -14
  108. data/lib/factories/chouette_access_links.rb +0 -11
  109. data/lib/factories/chouette_access_points.rb +0 -8
  110. data/lib/factories/chouette_companies.rb +0 -5
  111. data/lib/factories/chouette_connection_links.rb +0 -11
  112. data/lib/factories/chouette_footnotes.rb +0 -6
  113. data/lib/factories/chouette_group_of_lines.rb +0 -5
  114. data/lib/factories/chouette_journey_pattern.rb +0 -32
  115. data/lib/factories/chouette_lines.rb +0 -31
  116. data/lib/factories/chouette_networks.rb +0 -5
  117. data/lib/factories/chouette_routes.rb +0 -20
  118. data/lib/factories/chouette_stop_areas.rb +0 -8
  119. data/lib/factories/chouette_stop_points.rb +0 -7
  120. data/lib/factories/chouette_time_table.rb +0 -23
  121. data/lib/factories/chouette_vehicle_journey.rb +0 -51
  122. data/lib/factories/chouette_vehicle_journey_at_stop.rb +0 -5
  123. data/spec/dummy/config/initializers/active_record.rb +0 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 7b9d5a1a328226ec78cde56890239d9e182c1dc6
4
- data.tar.gz: 6fa77d618815fa1ae0845910a471fcc6ca3aaa24
3
+ metadata.gz: 00251189c84f005b277cc0237fea8d2d68674e4a
4
+ data.tar.gz: 45199b49e8b0e9483cf35d14981542783e4bf7b7
5
5
  SHA512:
6
- metadata.gz: 73563d719a56e21c1c48d64d8e27163cd1d600b51513762d2c5d58d15646ca463d43aab64870fcdf3775de458b788c96d713870c374b3730f659417d3a9d231f
7
- data.tar.gz: fc06f66345af8e3fcd13a1e5fd4fcde3747d56f6a287b27e628def3812d74acfd021c92713495210df8f67abaa4c357a0b7974238f87c66eb22e783750a7d0f9
6
+ metadata.gz: 65d6c2a966940aa23f9e1bddc7ddf29c5efa43ec27cacba74759d64c5a74e0fda9e33238bc6e58337d78a126941f331ebe7069c035dd799541e62de04b7b29d4
7
+ data.tar.gz: 6abccc002329cc535fe7df7586ea75baf09e80a14af49b2f9ee0f26a6e83f5a6d8a0f32aac45ec40d288e6d651cccdabd96ee83ecf0877d210d213fb4ffd0eb6
data/Rakefile CHANGED
@@ -5,19 +5,10 @@ rescue LoadError
5
5
  puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
6
6
  end
7
7
 
8
- APP_RAKEFILE = File.expand_path("../spec/dummy/Rakefile", __FILE__)
9
- load 'rails/tasks/engine.rake'
10
-
11
- Bundler::GemHelper.install_tasks
12
-
13
8
  namespace :ci do
14
- task :prepare do
15
- cp "config/database.yml.ci", "config/database.yml"
16
- end
17
- task :travis do
9
+ task :db_travis_config do
18
10
  cp "config/database.yml.travis", "config/database.yml"
19
11
  end
20
- task :build => ["db:migrate", "spec"]
21
12
  end
22
13
 
23
14
  begin
@@ -36,14 +27,20 @@ RDoc::Task.new(:rdoc) do |rdoc|
36
27
  rdoc.rdoc_files.include('lib/**/*.rb')
37
28
  end
38
29
 
30
+ APP_RAKEFILE = File.expand_path("../spec/dummy/Rakefile", __FILE__)
31
+ load 'rails/tasks/engine.rake'
32
+
33
+ Bundler::GemHelper.install_tasks
34
+
39
35
  require 'rspec/core'
40
36
  require 'rspec/core/rake_task'
41
37
 
42
38
  RSpec::Core::RakeTask.new(:spec)
43
39
 
44
- task :spec => "app:db:test:prepare"
45
-
46
40
  RSpec::Core::RakeTask.new(:rcov) do |t|
47
41
  t.rcov = true
48
42
  t.rcov_opts = %w{--exclude osx\/objc,gems\/,spec\/,lib\/database_cleaner\/}
49
43
  end
44
+
45
+ task :spec => "app:db:test:prepare"
46
+
@@ -1,67 +1,68 @@
1
- class Chouette::AccessLink < Chouette::TridentActiveRecord
2
- # FIXME http://jira.codehaus.org/browse/JRUBY-6358
3
- self.primary_key = "id"
1
+ module Chouette
2
+ class AccessLink < TridentActiveRecord
3
+ # FIXME http://jira.codehaus.org/browse/JRUBY-6358
4
+ self.primary_key = "id"
4
5
 
5
- attr_accessor :access_link_type, :link_orientation_type, :link_key
6
+ attr_accessor :access_link_type, :link_orientation_type, :link_key
6
7
 
7
- attr_accessible :id, :access_link_type,:access_point_id, :stop_area_id
8
- attr_accessible :objectid, :object_version, :creation_time, :creator_id, :name, :comment
9
- attr_accessible :link_distance, :link_type, :default_duration, :frequent_traveller_duration, :occasional_traveller_duration
10
- attr_accessible :mobility_restricted_traveller_duration, :mobility_restricted_suitability, :stairs_availability, :lift_availability, :int_user_needs
11
- attr_accessible :link_orientation
12
- attr_accessible :link_orientation_type, :stop_area
8
+ # attr_accessible :id, :access_link_type,:access_point_id, :stop_area_id
9
+ # attr_accessible :objectid, :object_version, :creation_time, :creator_id, :name, :comment
10
+ # attr_accessible :link_distance, :link_type, :default_duration, :frequent_traveller_duration, :occasional_traveller_duration
11
+ # attr_accessible :mobility_restricted_traveller_duration, :mobility_restricted_suitability, :stairs_availability, :lift_availability, :int_user_needs
12
+ # attr_accessible :link_orientation
13
+ # attr_accessible :link_orientation_type, :stop_area
13
14
 
14
- belongs_to :access_point, :class_name => 'Chouette::AccessPoint'
15
- belongs_to :stop_area, :class_name => 'Chouette::StopArea'
15
+ belongs_to :access_point, :class_name => 'Chouette::AccessPoint'
16
+ belongs_to :stop_area, :class_name => 'Chouette::StopArea'
16
17
 
17
- validates_presence_of :name
18
- validates_presence_of :link_type
19
- validates_presence_of :link_orientation
18
+ validates_presence_of :name
19
+ validates_presence_of :link_type
20
+ validates_presence_of :link_orientation
20
21
 
21
- def access_link_type
22
- link_type && Chouette::ConnectionLinkType.new(link_type.underscore)
23
- end
22
+ def access_link_type
23
+ link_type && Chouette::ConnectionLinkType.new(link_type.underscore)
24
+ end
24
25
 
25
- def access_link_type=(access_link_type)
26
- self.link_type = (access_link_type ? access_link_type.camelcase : nil)
27
- end
26
+ def access_link_type=(access_link_type)
27
+ self.link_type = (access_link_type ? access_link_type.camelcase : nil)
28
+ end
28
29
 
29
- @@access_link_types = nil
30
- def self.access_link_types
31
- @@access_link_types ||= Chouette::ConnectionLinkType.all
32
- end
30
+ @@access_link_types = nil
31
+ def self.access_link_types
32
+ @@access_link_types ||= Chouette::ConnectionLinkType.all
33
+ end
33
34
 
34
- def link_orientation_type
35
- link_orientation && Chouette::LinkOrientationType.new(link_orientation.underscore)
36
- end
35
+ def link_orientation_type
36
+ link_orientation && Chouette::LinkOrientationType.new(link_orientation.underscore)
37
+ end
37
38
 
38
- def link_orientation_type=(link_orientation_type)
39
- self.link_orientation = (link_orientation_type ? link_orientation_type.camelcase : nil)
40
- end
39
+ def link_orientation_type=(link_orientation_type)
40
+ self.link_orientation = (link_orientation_type ? link_orientation_type.camelcase : nil)
41
+ end
41
42
 
42
- @@link_orientation_types = nil
43
- def self.link_orientation_types
44
- @@link_orientation_types ||= Chouette::LinkOrientationType.all
45
- end
43
+ @@link_orientation_types = nil
44
+ def self.link_orientation_types
45
+ @@link_orientation_types ||= Chouette::LinkOrientationType.all
46
+ end
46
47
 
47
- def geometry
48
- GeoRuby::SimpleFeatures::LineString.from_points( [ access_point.geometry, stop_area.geometry], 4326) if access_point.geometry and stop_area.geometry
49
- end
48
+ def geometry
49
+ GeoRuby::SimpleFeatures::LineString.from_points( [ access_point.geometry, stop_area.geometry], 4326) if access_point.geometry and stop_area.geometry
50
+ end
50
51
 
51
- def link_key
52
- Chouette::AccessLink.build_link_key(access_point,stop_area,link_orientation_type)
53
- end
54
-
55
- def self.build_link_key(access_point,stop_area,link_orientation_type)
56
- if link_orientation_type == "access_point_to_stop_area"
57
- "A_#{access_point.id}-S_#{stop_area.id}"
58
- else
59
- "S_#{stop_area.id}-A_#{access_point.id}"
52
+ def link_key
53
+ Chouette::AccessLink.build_link_key(access_point,stop_area,link_orientation_type)
54
+ end
55
+
56
+ def self.build_link_key(access_point,stop_area,link_orientation_type)
57
+ if link_orientation_type == "access_point_to_stop_area"
58
+ "A_#{access_point.id}-S_#{stop_area.id}"
59
+ else
60
+ "S_#{stop_area.id}-A_#{access_point.id}"
61
+ end
60
62
  end
61
- end
62
63
 
63
- def geometry_presenter
64
- Chouette::Geometry::AccessLinkPresenter.new self
64
+ def geometry_presenter
65
+ Chouette::Geometry::AccessLinkPresenter.new self
66
+ end
65
67
  end
66
68
  end
67
-
@@ -11,13 +11,13 @@ class Chouette::AccessPoint < Chouette::TridentActiveRecord
11
11
  attr_accessor :access_point_type
12
12
  attr_writer :coordinates
13
13
 
14
- attr_accessible :objectid, :object_version, :creation_time, :creator_id, :name, :comment
15
- attr_accessible :longitude, :latitude, :long_lat_type
16
- attr_accessible :country_code, :street_name, :zip_code, :city_name
17
- attr_accessible :openning_time, :closing_time, :access_type, :access_point_type
18
- attr_accessible :mobility_restricted_suitability, :stairs_availability, :lift_availability
19
- attr_accessible :stop_area_id
20
- attr_accessible :coordinates
14
+ # attr_accessible :objectid, :object_version, :creation_time, :creator_id, :name, :comment
15
+ # attr_accessible :longitude, :latitude, :long_lat_type
16
+ # attr_accessible :country_code, :street_name, :zip_code, :city_name
17
+ # attr_accessible :openning_time, :closing_time, :access_type, :access_point_type
18
+ # attr_accessible :mobility_restricted_suitability, :stairs_availability, :lift_availability
19
+ # attr_accessible :stop_area_id
20
+ # attr_accessible :coordinates
21
21
 
22
22
  validates_presence_of :name
23
23
  validates_presence_of :access_type
@@ -21,46 +21,46 @@ module Chouette
21
21
  self.class.human_attribute_name(*args)
22
22
  end
23
23
 
24
- class << self
25
- alias_method :create_reflection_without_chouette_naming, :create_reflection
24
+ # class << self
25
+ # alias_method :create_reflection_without_chouette_naming, :create_reflection
26
26
 
27
- def create_reflection(macro, name, options, active_record)
28
- options =
29
- Reflection.new(macro, name, options, active_record).options_with_default
27
+ # def create_reflection(macro, name, options, active_record)
28
+ # options =
29
+ # Reflection.new(macro, name, options, active_record).options_with_default
30
30
 
31
- create_reflection_without_chouette_naming(macro, name, options, active_record)
32
- end
33
- end
31
+ # create_reflection_without_chouette_naming(macro, name, options, active_record)
32
+ # end
33
+ # end
34
34
 
35
35
 
36
36
 
37
- class Reflection
37
+ # class Reflection
38
38
 
39
- attr_reader :macro, :name, :options, :active_record
39
+ # attr_reader :macro, :name, :options, :active_record
40
40
 
41
- def initialize(macro, name, options, active_record)
42
- @macro, @name, @options, @active_record = macro, name.to_s, options, active_record
43
- end
41
+ # def initialize(macro, name, options, active_record)
42
+ # @macro, @name, @options, @active_record = macro, name.to_s, options, active_record
43
+ # end
44
44
 
45
- def collection?
46
- macro == :has_many
47
- end
45
+ # def collection?
46
+ # macro == :has_many
47
+ # end
48
48
 
49
- def singular_name
50
- collection? ? name.singularize : name
51
- end
49
+ # def singular_name
50
+ # collection? ? name.singularize : name
51
+ # end
52
52
 
53
- def class_name
54
- "Chouette::#{singular_name.camelize}"
55
- end
53
+ # def class_name
54
+ # "Chouette::#{singular_name.camelize}"
55
+ # end
56
56
 
57
- def options_with_default
58
- options.dup.tap do |options|
59
- options[:class_name] ||= class_name
60
- end
61
- end
57
+ # def options_with_default
58
+ # options.dup.tap do |options|
59
+ # options[:class_name] ||= class_name
60
+ # end
61
+ # end
62
62
 
63
- end
63
+ # end
64
64
 
65
65
  end
66
66
  end
@@ -7,9 +7,9 @@ class Chouette::Company < Chouette::TridentActiveRecord
7
7
 
8
8
  validates_presence_of :name
9
9
 
10
- attr_accessible :objectid, :object_version, :creation_time, :creator_id, :name, :short_name
11
- attr_accessible :organizational_unit, :operating_department_name, :code, :phone, :fax, :email, :registration_number
12
- attr_accessible :url, :time_zone
10
+ # attr_accessible :objectid, :object_version, :creation_time, :creator_id, :name, :short_name
11
+ # attr_accessible :organizational_unit, :operating_department_name, :code, :phone, :fax, :email, :registration_number
12
+ # attr_accessible :url, :time_zone
13
13
 
14
14
  validates_format_of :url, :with => %r{\Ahttps?:\/\/([\da-z\.-]+)\.([a-z\.]{2,6})([\/\w \.-]*)*\/?\Z}, :allow_nil => true, :allow_blank => true
15
15
 
@@ -4,9 +4,9 @@ class Chouette::ConnectionLink < Chouette::TridentActiveRecord
4
4
 
5
5
  attr_accessor :connection_link_type
6
6
 
7
- attr_accessible :connection_link_type,:departure_id, :arrival_id, :objectid, :object_version, :creation_time, :creator_id, :name, :comment
8
- attr_accessible :link_distance, :link_type, :default_duration, :frequent_traveller_duration, :occasional_traveller_duration
9
- attr_accessible :mobility_restricted_traveller_duration, :mobility_restricted_suitability, :stairs_availability, :lift_availability, :int_user_needs
7
+ # attr_accessible :connection_link_type,:departure_id, :arrival_id, :objectid, :object_version, :creation_time, :creator_id, :name, :comment
8
+ # attr_accessible :link_distance, :link_type, :default_duration, :frequent_traveller_duration, :occasional_traveller_duration
9
+ # attr_accessible :mobility_restricted_traveller_duration, :mobility_restricted_suitability, :stairs_availability, :lift_availability, :int_user_needs
10
10
 
11
11
  belongs_to :departure, :class_name => 'Chouette::StopArea'
12
12
  belongs_to :arrival, :class_name => 'Chouette::StopArea'
@@ -1,6 +1,6 @@
1
1
  class Chouette::Footnote < Chouette::ActiveRecord
2
2
  # attr_accessible :title, :body
3
- belongs_to :line
3
+ belongs_to :line, inverse_of: :footnotes
4
4
  has_and_belongs_to_many :vehicle_journeys, :class_name => 'Chouette::VehicleJourney'
5
5
 
6
6
  validates_presence_of :line
@@ -6,8 +6,8 @@ class Chouette::GroupOfLine < Chouette::TridentActiveRecord
6
6
 
7
7
  validates_presence_of :name
8
8
 
9
- attr_accessible :objectid, :object_version, :creation_time, :creator_id, :name, :comment, :lines, :registration_number
10
- attr_accessible :line_tokens
9
+ # attr_accessible :objectid, :object_version, :creation_time, :creator_id, :name, :comment, :lines, :registration_number
10
+ # attr_accessible :line_tokens
11
11
  attr_reader :line_tokens
12
12
 
13
13
  def self.nullable_attributes
@@ -5,9 +5,9 @@ class Chouette::JourneyPattern < Chouette::TridentActiveRecord
5
5
  belongs_to :route
6
6
  has_many :vehicle_journeys, :dependent => :destroy
7
7
  has_many :vehicle_journey_at_stops, :through => :vehicle_journeys
8
- has_and_belongs_to_many :stop_points, :class_name => 'Chouette::StopPoint', :order => 'stop_points.position', :before_add => :vjas_add, :before_remove => :vjas_remove, :after_add => :shortcuts_update_for_add, :after_remove => :shortcuts_update_for_remove
8
+ has_and_belongs_to_many :stop_points, -> { order("stop_points.position") }, :before_add => :vjas_add, :before_remove => :vjas_remove, :after_add => :shortcuts_update_for_add, :after_remove => :shortcuts_update_for_remove
9
9
 
10
- attr_accessible :route_id, :objectid, :object_version, :creation_time, :creator_id, :name, :comment, :registration_number, :published_name, :departure_stop_point_id, :arrival_stop_point_id, :stop_point_ids, :stop_points
10
+ #attr_accessible :route_id, :objectid, :object_version, :creation_time, :creator_id, :name, :comment, :registration_number, :published_name, :departure_stop_point_id, :arrival_stop_point_id, :stop_point_ids, :stop_points
11
11
 
12
12
  validates_presence_of :route
13
13
 
@@ -24,6 +24,7 @@ class Chouette::JourneyPattern < Chouette::TridentActiveRecord
24
24
  return unless departure_stop_point_id
25
25
  Chouette::StopPoint.find( departure_stop_point_id)
26
26
  end
27
+
27
28
  def arrival_stop_point
28
29
  return unless arrival_stop_point_id
29
30
  Chouette::StopPoint.find( arrival_stop_point_id)
@@ -38,6 +39,7 @@ class Chouette::JourneyPattern < Chouette::TridentActiveRecord
38
39
  self.update_attributes( :departure_stop_point_id => (ordered_stop_points.first && ordered_stop_points.first.id),
39
40
  :arrival_stop_point_id => (ordered_stop_points.last && ordered_stop_points.last.id))
40
41
  end
42
+
41
43
  def shortcuts_update_for_remove( stop_point)
42
44
  stop_points.delete( stop_point) if stop_points.include?( stop_point)
43
45
 
@@ -47,6 +49,7 @@ class Chouette::JourneyPattern < Chouette::TridentActiveRecord
47
49
  self.update_attributes( :departure_stop_point_id => (ordered_stop_points.first && ordered_stop_points.first.id),
48
50
  :arrival_stop_point_id => (ordered_stop_points.last && ordered_stop_points.last.id))
49
51
  end
52
+
50
53
  def vjas_add( stop_point)
51
54
  return if new_record?
52
55
 
@@ -54,9 +57,10 @@ class Chouette::JourneyPattern < Chouette::TridentActiveRecord
54
57
  vjas = vj.vehicle_journey_at_stops.create :stop_point_id => stop_point.id
55
58
  end
56
59
  end
60
+
57
61
  def vjas_remove( stop_point)
58
62
  return if new_record?
59
-
63
+
60
64
  vehicle_journey_at_stops.where( :stop_point_id => stop_point.id).each do |vjas|
61
65
  vjas.destroy
62
66
  end
@@ -2,11 +2,12 @@ class Chouette::Line < Chouette::TridentActiveRecord
2
2
  # FIXME http://jira.codehaus.org/browse/JRUBY-6358
3
3
  self.primary_key = "id"
4
4
 
5
- attr_accessor :transport_mode
6
- attr_accessible :transport_mode, :network_id, :company_id, :objectid, :object_version
7
- attr_accessible :creation_time, :creator_id, :name, :number, :published_name, :transport_mode_name
8
- attr_accessible :registration_number, :comment, :mobility_restricted_suitability, :int_user_needs
9
- attr_accessible :flexible_service
5
+ # attr_accessible :transport_mode, :network_id, :company_id, :objectid, :object_version
6
+ # attr_accessible :creation_time, :creator_id, :name, :number, :published_name, :transport_mode_name
7
+ # attr_accessible :registration_number, :comment, :mobility_restricted_suitability, :int_user_needs
8
+ # attr_accessible :flexible_service
9
+ # attr_accessible :group_of_lines, :group_of_line_ids, :group_of_line_tokens
10
+ # attr_accessible :url, :color, :text_color
10
11
 
11
12
  belongs_to :company
12
13
  belongs_to :network
@@ -16,13 +17,14 @@ class Chouette::Line < Chouette::TridentActiveRecord
16
17
 
17
18
  has_and_belongs_to_many :group_of_lines, :class_name => 'Chouette::GroupOfLine', :order => 'group_of_lines.name'
18
19
 
19
- has_many :footnotes, :dependent => :destroy
20
+ has_many :footnotes, :inverse_of => :line, :validate => :true, :dependent => :destroy
20
21
  accepts_nested_attributes_for :footnotes, :reject_if => :all_blank, :allow_destroy => true
21
- attr_accessible :footnotes_attributes
22
+ #attr_accessible :footnotes_attributes
22
23
 
23
- attr_accessible :group_of_lines, :group_of_line_ids, :group_of_line_tokens
24
- attr_accessible :url, :color, :text_color
24
+ #attr_accessible :group_of_lines, :group_of_line_ids, :group_of_line_tokens
25
+ #attr_accessible :url, :color, :text_color
25
26
  attr_reader :group_of_line_tokens
27
+ attr_accessor :transport_mode
26
28
 
27
29
  validates_presence_of :network
28
30
  validates_presence_of :company
@@ -10,8 +10,8 @@ class Chouette::Network < Chouette::TridentActiveRecord
10
10
 
11
11
  validates_presence_of :name
12
12
 
13
- attr_accessible :objectid, :object_version, :creation_time, :creator_id, :version_date, :description, :name
14
- attr_accessible :registration_number, :source_name, :source_type, :source_identifier, :comment
13
+ # attr_accessible :objectid, :object_version, :creation_time, :creator_id, :version_date, :description, :name
14
+ # attr_accessible :registration_number, :source_name, :source_type, :source_identifier, :comment
15
15
 
16
16
  def self.object_id_key
17
17
  "GroupOfLine"
@@ -4,7 +4,7 @@ class Chouette::PtLink < Chouette::ActiveRecord
4
4
  # FIXME http://jira.codehaus.org/browse/JRUBY-6358
5
5
  self.primary_key = "id"
6
6
 
7
- attr_accessible :start_of_link_id, :end_of_link_id, :route_id, :objectid, :object_version, :creation_time, :creator_id, :name, :comment, :link_distance
7
+ # attr_accessible :start_of_link_id, :end_of_link_id, :route_id, :objectid, :object_version, :creation_time, :creator_id, :name, :comment, :link_distance
8
8
  include Geokit::Mappable
9
9
 
10
10
 
@@ -5,11 +5,11 @@ class Chouette::Route < Chouette::TridentActiveRecord
5
5
  attr_accessor :wayback_code
6
6
  attr_accessor :direction_code
7
7
 
8
- attr_accessible :direction_code, :wayback_code, :line_id, :objectid, :object_version, :creation_time, :creator_id, :name
9
- attr_accessible :comment, :opposite_route_id, :published_name, :number, :direction, :wayback, :stop_points_attributes
8
+ # attr_accessible :direction_code, :wayback_code, :line_id, :objectid, :object_version, :creation_time, :creator_id, :name
9
+ # attr_accessible :comment, :opposite_route_id, :published_name, :number, :direction, :wayback, :stop_points_attributes
10
10
 
11
11
  def self.nullable_attributes
12
- [:published_name, :comment, :number]
12
+ [:published_name, :comment, :number, :name]
13
13
  end
14
14
 
15
15
  belongs_to :line
@@ -21,7 +21,7 @@ class Chouette::Route < Chouette::TridentActiveRecord
21
21
  end
22
22
  end
23
23
  belongs_to :opposite_route, :class_name => 'Chouette::Route', :foreign_key => :opposite_route_id
24
- has_many :stop_points, :order => 'position', :dependent => :destroy do
24
+ has_many :stop_points, -> { order('position ASC') }, :dependent => :destroy do
25
25
  def find_by_stop_area(stop_area)
26
26
  stop_area_ids = Integer === stop_area ? [stop_area] : (stop_area.children_in_depth + [stop_area]).map(&:id)
27
27
  where( :stop_area_id => stop_area_ids).first or
@@ -44,7 +44,7 @@ class Chouette::Route < Chouette::TridentActiveRecord
44
44
  where(" position between ? and ? ", between_positions.first, between_positions.last)
45
45
  end
46
46
  end
47
- has_many :stop_areas, :through => :stop_points, :order => 'stop_points.position' do
47
+ has_many :stop_areas, -> { order('stop_points.position ASC') }, :through => :stop_points do
48
48
  def between(departure, arrival)
49
49
  departure, arrival = [departure, arrival].collect do |endpoint|
50
50
  String === endpoint ? Chouette::StopArea.find_by_objectid(endpoint) : endpoint
@@ -54,10 +54,10 @@ class Chouette::Route < Chouette::TridentActiveRecord
54
54
  end
55
55
  accepts_nested_attributes_for :stop_points, :allow_destroy => :true
56
56
 
57
- validates_presence_of :name
57
+ # validates_presence_of :name
58
58
  validates_presence_of :line
59
- validates_presence_of :direction_code
60
- validates_presence_of :wayback_code
59
+ # validates_presence_of :direction_code
60
+ # validates_presence_of :wayback_code
61
61
 
62
62
  before_destroy :dereference_opposite_route
63
63
 
@@ -83,7 +83,7 @@ class Chouette::Route < Chouette::TridentActiveRecord
83
83
  end
84
84
 
85
85
  def sorted_vehicle_journeys
86
- vehicle_journeys.includes( :vehicle_journey_at_stops, :journey_pattern).where( "vehicle_journey_at_stops.stop_point_id=journey_patterns.departure_stop_point_id").order( "vehicle_journey_at_stops.departure_time")
86
+ vehicle_journeys.joins(:journey_pattern, :vehicle_journey_at_stops).where("vehicle_journey_at_stops.stop_point_id=journey_patterns.departure_stop_point_id").order( "vehicle_journey_at_stops.departure_time")
87
87
  end
88
88
 
89
89
  def self.direction_binding
@@ -160,4 +160,3 @@ class Chouette::Route < Chouette::TridentActiveRecord
160
160
  return true
161
161
  end
162
162
  end
163
-
@@ -17,13 +17,13 @@ class Chouette::StopArea < Chouette::TridentActiveRecord
17
17
  attr_accessor :children_ids
18
18
  attr_writer :coordinates
19
19
 
20
- attr_accessible :routing_stop_ids, :routing_line_ids, :children_ids, :stop_area_type, :parent_id, :objectid
21
- attr_accessible :object_version, :creation_time, :creator_id, :name, :comment, :area_type, :registration_number
22
- attr_accessible :nearest_topic_name, :fare_code, :longitude, :latitude, :long_lat_type
23
- attr_accessible :country_code, :street_name, :zip_code, :city_name
24
- attr_accessible :mobility_restricted_suitability, :stairs_availability, :lift_availability, :int_user_needs
25
- attr_accessible :coordinates
26
- attr_accessible :url, :time_zone
20
+ # attr_accessible :routing_stop_ids, :routing_line_ids, :children_ids, :stop_area_type, :parent_id, :objectid
21
+ # attr_accessible :object_version, :creation_time, :creator_id, :name, :comment, :area_type, :registration_number
22
+ # attr_accessible :nearest_topic_name, :fare_code, :longitude, :latitude, :long_lat_type
23
+ # attr_accessible :country_code, :street_name, :zip_code, :city_name
24
+ # attr_accessible :mobility_restricted_suitability, :stairs_availability, :lift_availability, :int_user_needs
25
+ # attr_accessible :coordinates
26
+ # attr_accessible :url, :time_zone
27
27
 
28
28
  validates_uniqueness_of :registration_number, :allow_nil => true, :allow_blank => true
29
29
  validates_format_of :registration_number, :with => %r{\A[\d\w_\-]+\Z}, :allow_blank => true
@@ -246,7 +246,7 @@ class Chouette::StopArea < Chouette::TridentActiveRecord
246
246
 
247
247
  def self.default_geometry!
248
248
  count = 0
249
- scoped.find_each do |stop_area|
249
+ where(nil).find_each do |stop_area|
250
250
  Chouette::StopArea.unscoped do
251
251
  count += 1 if stop_area.default_geometry!
252
252
  end
@@ -9,17 +9,17 @@ module Chouette
9
9
  belongs_to :stop_area
10
10
  belongs_to :route, inverse_of: :stop_points
11
11
  has_many :vehicle_journey_at_stops, :dependent => :destroy
12
- has_many :vehicle_journeys, :through => :vehicle_journey_at_stops, :uniq => true
12
+ has_many :vehicle_journeys, -> {uniq}, :through => :vehicle_journey_at_stops
13
13
 
14
14
  acts_as_list :scope => 'route_id = \'#{route.id}\'',:top_of_list => 0
15
15
 
16
- attr_accessible :route_id, :stop_area_id, :objectid, :object_version, :creation_time, :creator_id, :position, :for_boarding, :for_alighting
16
+ #attr_accessible :route_id, :stop_area_id, :objectid, :object_version, :creation_time, :creator_id, :position, :for_boarding, :for_alighting
17
17
 
18
18
  validates_presence_of :stop_area
19
19
  validate :stop_area_id_validation
20
20
 
21
21
  scope :default_order, order("position")
22
-
22
+
23
23
  before_destroy :remove_dependent_journey_pattern_stop_points
24
24
  def remove_dependent_journey_pattern_stop_points
25
25
  route.journey_patterns.each do |jp|