aboutsummaryrefslogtreecommitdiffstats
path: root/app
diff options
context:
space:
mode:
authorLuc Donnet2015-01-05 14:56:12 +0100
committerLuc Donnet2015-01-05 14:56:12 +0100
commit3bc6d313bebdc1f03e4021aabbc774a0cd97d938 (patch)
treeac5b8c6d8309012136606d9fd9b9a00290f486a8 /app
parente632a4634b1762f4c73d11f1e5b127de9832a1ff (diff)
downloadchouette-core-3bc6d313bebdc1f03e4021aabbc774a0cd97d938.tar.bz2
Initialize rails 4 migration
Diffstat (limited to 'app')
-rw-r--r--app/controllers/api/v1/chouette_controller.rb2
-rw-r--r--app/controllers/autocomplete_stop_areas_controller.rb2
-rw-r--r--app/controllers/chouette_controller.rb2
-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.rb32
-rw-r--r--app/models/rule_parameter_set.rb6
-rw-r--r--app/models/user.rb2
-rw-r--r--app/views/companies/_companies.erb2
10 files changed, 27 insertions, 27 deletions
diff --git a/app/controllers/api/v1/chouette_controller.rb b/app/controllers/api/v1/chouette_controller.rb
index b8879cd3f..c1d626adf 100644
--- a/app/controllers/api/v1/chouette_controller.rb
+++ b/app/controllers/api/v1/chouette_controller.rb
@@ -17,7 +17,7 @@ private
end
end
def switch_referential
- Apartment::Database.switch(@api_key.referential.slug)
+ Apartment::Tenant.switch(@api_key.referential.slug)
end
end
diff --git a/app/controllers/autocomplete_stop_areas_controller.rb b/app/controllers/autocomplete_stop_areas_controller.rb
index 64a62efe5..2d4a07002 100644
--- a/app/controllers/autocomplete_stop_areas_controller.rb
+++ b/app/controllers/autocomplete_stop_areas_controller.rb
@@ -4,7 +4,7 @@ class AutocompleteStopAreasController < InheritedResources::Base
before_filter :switch_referential
def switch_referential
- Apartment::Database.switch(referential.slug)
+ Apartment::Tenant.switch(referential.slug)
end
def referential
diff --git a/app/controllers/chouette_controller.rb b/app/controllers/chouette_controller.rb
index df082d8cd..204a3d6c5 100644
--- a/app/controllers/chouette_controller.rb
+++ b/app/controllers/chouette_controller.rb
@@ -6,7 +6,7 @@ class ChouetteController < BreadcrumbController
before_filter :switch_referential
def switch_referential
- Apartment::Database.switch(referential.slug)
+ Apartment::Tenant.switch(referential.slug)
end
def referential
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 41d239961..e5646d7e9 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
@@ -202,7 +202,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
@@ -216,7 +216,7 @@ Rails.application.config.after_initialize do
class Chouette::StopArea
- attr_accessible :projection_x,:projection_y,:projection_xy
+ #attr_accessible :projection_x,:projection_y,:projection_xy
# override default_position method to add referential envelope when no stoparea is positioned
def default_position
@@ -282,7 +282,7 @@ Rails.application.config.after_initialize do
Chouette::AccessPoint
class Chouette::AccessPoint
- attr_accessible :projection_x,:projection_y,:projection_xy
+ #attr_accessible :projection_x,:projection_y,:projection_xy
# add projection_type set on pre-insert and pre_update action
before_save :set_projections
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/views/companies/_companies.erb b/app/views/companies/_companies.erb
index fb36a86af..f059201e6 100644
--- a/app/views/companies/_companies.erb
+++ b/app/views/companies/_companies.erb
@@ -1,5 +1,5 @@
<div class="page_info">
- <span class="search"> <%= t("will_paginate.page_entries_info.search") %></span> <%= page_entries_info @companies %>
+ <span class="search"> <%= t("will_paginate.page_entries_info.search") %></span> <%= page_entries_info(@companies) %>
</div>
<div class="companies paginated_content">
<%= paginated_content(@companies) %>