aboutsummaryrefslogtreecommitdiffstats
path: root/app/models
diff options
context:
space:
mode:
authorTeddy Wing2017-07-20 12:21:35 +0200
committerTeddy Wing2017-07-20 12:21:35 +0200
commit9b3778f8d2afe93486ea8e49ec7730cb1ec2be1e (patch)
treef00016286e5af968c0b6efa3d7969cfa1dc8bdba /app/models
parent42a51eef7d242583726c4942583b4ab567c4d293 (diff)
parent4fd4fa0fd24c9cd86161358f2e36cff64f3712d7 (diff)
downloadchouette-core-9b3778f8d2afe93486ea8e49ec7730cb1ec2be1e.tar.bz2
Merge remote-tracking branch 'origin/master' into 1726-WorkbenchImport-for-multi-Netex-import
Diffstat (limited to 'app/models')
-rw-r--r--app/models/chouette/stop_point.rb4
-rw-r--r--app/models/chouette/vehicle_journey.rb2
-rw-r--r--app/models/concerns/default_attributes_support.rb3
-rw-r--r--app/models/referential.rb2
4 files changed, 6 insertions, 5 deletions
diff --git a/app/models/chouette/stop_point.rb b/app/models/chouette/stop_point.rb
index 3dbf6be0d..8fe79dc0c 100644
--- a/app/models/chouette/stop_point.rb
+++ b/app/models/chouette/stop_point.rb
@@ -36,12 +36,12 @@ module Chouette
def stop_area_id_validation
if stop_area_id.nil?
- errors.add(:stop_area_id, I18n.t("errors.messages.empty"))
+ errors.add(:stop_area_id, I18n.t("stop_areas.errors.empty"))
end
end
def self.area_candidates
- Chouette::StopArea.where( :area_type => ['Quay', 'BoardingPosition'])
+ Chouette::StopArea.where(:area_type => ['Quay', 'BoardingPosition'])
end
end
diff --git a/app/models/chouette/vehicle_journey.rb b/app/models/chouette/vehicle_journey.rb
index 71c339780..19299d098 100644
--- a/app/models/chouette/vehicle_journey.rb
+++ b/app/models/chouette/vehicle_journey.rb
@@ -142,7 +142,7 @@ module Chouette
vj.update_attributes(state_permited_attributes(item))
vj.update_has_and_belongs_to_many_from_state(item)
- item['errors'] = vj.errors if vj.errors.any?
+ item['errors'] = vj.errors.full_messages.uniq if vj.errors.any?
end
# Delete ids of new object from state if we had to rollback
diff --git a/app/models/concerns/default_attributes_support.rb b/app/models/concerns/default_attributes_support.rb
index 7928093e6..e85a59160 100644
--- a/app/models/concerns/default_attributes_support.rb
+++ b/app/models/concerns/default_attributes_support.rb
@@ -77,7 +77,8 @@ module DefaultAttributesSupport
def build_objectid
if objectid.include? ':__pending_id__'
fix_uniq_objectid
- update_attributes( :objectid => objectid, :object_version => (object_version - 1) )
+ self.object_version = object_version - 1
+ self.save(validate: false)
end
end
diff --git a/app/models/referential.rb b/app/models/referential.rb
index ed23e2e51..e65d6a33b 100644
--- a/app/models/referential.rb
+++ b/app/models/referential.rb
@@ -186,7 +186,7 @@ class Referential < ActiveRecord::Base
before_validation :clone_associations, :on => :create, if: :created_from
before_validation :assign_slug, :on => :create
before_validation :assign_prefix, :on => :create
- before_create :create_schema, unless: :created_from
+ before_create :create_schema
after_create :clone_schema, if: :created_from