aboutsummaryrefslogtreecommitdiffstats
path: root/app/models
diff options
context:
space:
mode:
Diffstat (limited to 'app/models')
-rw-r--r--app/models/compliance_check_result.rb2
-rw-r--r--app/models/compliance_check_task.rb2
-rw-r--r--app/models/export.rb2
-rw-r--r--app/models/referential.rb29
-rw-r--r--app/models/rule_parameter_set.rb6
-rw-r--r--app/models/user.rb2
-rw-r--r--app/models/vehicle_translation.rb2
7 files changed, 22 insertions, 23 deletions
diff --git a/app/models/compliance_check_result.rb b/app/models/compliance_check_result.rb
index 72cb4f13e..f34cf7911 100644
--- a/app/models/compliance_check_result.rb
+++ b/app/models/compliance_check_result.rb
@@ -7,7 +7,7 @@ class ComplianceCheckResult < ActiveRecord::Base
scope :nok, -> { where status: 'nok' }
scope :na, -> { where status: 'na' }
- attr_accessible :violation_count
+ #attr_accessible :violation_count
belongs_to :compliance_check_task
validates_presence_of :rule_code
diff --git a/app/models/compliance_check_task.rb b/app/models/compliance_check_task.rb
index 1808a792c..ef35fcbdc 100644
--- a/app/models/compliance_check_task.rb
+++ b/app/models/compliance_check_task.rb
@@ -10,7 +10,7 @@ class ComplianceCheckTask < ActiveRecord::Base
validates_presence_of :user_name
validates_inclusion_of :status, :in => %w{ pending processing completed failed }
- has_many :compliance_check_results, :order => [ :severity , :status ]
+ has_many :compliance_check_results, -> { order([ :severity , :status ]) }
serialize :parameter_set, JSON
diff --git a/app/models/export.rb b/app/models/export.rb
index 4d7b5c56c..99e499c2d 100644
--- a/app/models/export.rb
+++ b/app/models/export.rb
@@ -5,7 +5,7 @@ class Export < ActiveRecord::Base
validates_inclusion_of :status, :in => %w{ pending processing completed failed }
- has_many :log_messages, :class_name => "ExportLogMessage", :order => :position, :dependent => :delete_all
+ has_many :log_messages, -> { order('position ASC') }, :class_name => "ExportLogMessage", :dependent => :delete_all
serialize :options
diff --git a/app/models/referential.rb b/app/models/referential.rb
index 063e7436c..be6e3a3ad 100644
--- a/app/models/referential.rb
+++ b/app/models/referential.rb
@@ -50,43 +50,43 @@ class Referential < ActiveRecord::Base
end
def lines
- Chouette::Line.scoped
+ Chouette::Line.all
end
def networks
- Chouette::Network.scoped
+ Chouette::Network.all
end
def group_of_lines
- Chouette::GroupOfLine.scoped
+ Chouette::GroupOfLine.all
end
def companies
- Chouette::Company.scoped
+ Chouette::Company.all
end
def stop_areas
- Chouette::StopArea.scoped
+ Chouette::StopArea.all
end
def access_points
- Chouette::AccessPoint.scoped
+ Chouette::AccessPoint.all
end
def access_links
- Chouette::AccessLink.scoped
+ Chouette::AccessLink.all
end
def time_tables
- Chouette::TimeTable.scoped
+ Chouette::TimeTable.all
end
def connection_links
- Chouette::ConnectionLink.scoped
+ Chouette::ConnectionLink.all
end
def vehicle_journeys
- Chouette::VehicleJourney.scoped
+ Chouette::VehicleJourney.all
end
after_initialize :define_default_attributes
@@ -97,7 +97,7 @@ class Referential < ActiveRecord::Base
def switch
raise "Referential not created" if new_record?
- Apartment::Database.switch(slug)
+ Apartment::Tenant.switch(slug)
self
end
@@ -139,12 +139,12 @@ class Referential < ActiveRecord::Base
before_create :create_schema
def create_schema
- Apartment::Database.create slug
+ Apartment::Tenant.create slug
end
before_destroy :destroy_schema
def destroy_schema
- Apartment::Database.drop slug
+ Apartment::Tenant.drop slug
end
after_create :add_rule_parameter_set
@@ -204,7 +204,7 @@ Rails.application.config.after_initialize do
# add referential relationship for objectid and localization functions
def referential
- @referential ||= Referential.where(:slug => Apartment::Database.current_database).first!
+ @referential ||= Referential.where(:slug => Apartment::Tenant.current_tenant).first!
end
# override prefix for good prefix in objectid generation
@@ -233,7 +233,6 @@ Rails.application.config.after_initialize do
Chouette::StopArea
class Chouette::StopArea
-
include NinoxeExtension::ProjectionFields
# override default_position method to add referential envelope when no stoparea is positioned
diff --git a/app/models/rule_parameter_set.rb b/app/models/rule_parameter_set.rb
index 0c7a98300..b8c5a2f8f 100644
--- a/app/models/rule_parameter_set.rb
+++ b/app/models/rule_parameter_set.rb
@@ -6,7 +6,7 @@ class RuleParameterSet < ActiveRecord::Base
serialize :parameters, JSON
- attr_accessible :name, :referential_id
+ #attr_accessible :name, :referential_id
def self.mode_attribute_prefixes
%w( allowed_transport inter_stop_area_distance_min inter_stop_area_distance_max speed_max speed_min inter_stop_duration_variation_max)
@@ -39,7 +39,7 @@ class RuleParameterSet < ActiveRecord::Base
def self.mode_parameter(name)
name = name.to_s
- attr_accessible name
+ #attr_accessible name
define_method(name) do
attribute_name, mode = RuleParameterSet.attribute_of_mode_attribute( name), RuleParameterSet.mode_of_mode_attribute( name)
@@ -54,7 +54,7 @@ class RuleParameterSet < ActiveRecord::Base
end
def self.parameter(name)
name = name.to_s
- attr_accessible name
+ #attr_accessible name
define_method(name) do
self.parameters and self.parameters[name]
diff --git a/app/models/user.rb b/app/models/user.rb
index 6c14b93fb..e37ff62d5 100644
--- a/app/models/user.rb
+++ b/app/models/user.rb
@@ -6,7 +6,7 @@ class User < ActiveRecord::Base
:confirmable, :invitable
# Setup accessible (or protected) attributes for your model
- attr_accessible :email, :password, :current_password, :password_confirmation, :remember_me, :name, :organisation_attributes
+ # attr_accessible :email, :password, :current_password, :password_confirmation, :remember_me, :name, :organisation_attributes
belongs_to :organisation
diff --git a/app/models/vehicle_translation.rb b/app/models/vehicle_translation.rb
index f89c127ab..76d679c30 100644
--- a/app/models/vehicle_translation.rb
+++ b/app/models/vehicle_translation.rb
@@ -5,7 +5,6 @@ class VehicleTranslation
attr_accessor :vehicle_journey_id, :count, :duration
attr_accessor :first_stop_time, :departure_or_arrival
- attr_accessor :delta
validates_presence_of :count, :duration, :first_stop_time, :departure_or_arrival
validates_inclusion_of :departure_or_arrival, :in => %w( departure arrival)
@@ -75,6 +74,7 @@ class VehicleTranslation
vehicle_journey.vehicle_journey_at_stops.each do |vjas|
vjas_attributes = vjas.attributes.merge( "vehicle_journey_id" => translated.id)
+ vjas_attributes.delete( "id" )
vjas_attributes.merge! "departure_time" => ( vjas_attributes[ "departure_time"] + delta),
"arrival_time" => ( vjas_attributes[ "arrival_time"] + delta)