aboutsummaryrefslogtreecommitdiffstats
path: root/app/models
diff options
context:
space:
mode:
Diffstat (limited to 'app/models')
-rw-r--r--app/models/chouette/line.rb2
-rw-r--r--app/models/referential.rb10
2 files changed, 9 insertions, 3 deletions
diff --git a/app/models/chouette/line.rb b/app/models/chouette/line.rb
index f2e3a2b08..c3a867caa 100644
--- a/app/models/chouette/line.rb
+++ b/app/models/chouette/line.rb
@@ -18,8 +18,6 @@ class Chouette::Line < Chouette::ActiveRecord
has_many :footnotes, :inverse_of => :line, :validate => :true, :dependent => :destroy
accepts_nested_attributes_for :footnotes, :reject_if => :all_blank, :allow_destroy => true
- belongs_to_array_in_many :referential_metadatas
-
attr_reader :group_of_line_tokens
attr_accessor :transport_mode
diff --git a/app/models/referential.rb b/app/models/referential.rb
index f8f8961ff..9612b1022 100644
--- a/app/models/referential.rb
+++ b/app/models/referential.rb
@@ -28,11 +28,14 @@ class Referential < ActiveRecord::Base
belongs_to :line_referential
validates_presence_of :line_referential
+
has_many :lines, through: :line_referential
has_many :companies, through: :line_referential
has_many :group_of_lines, through: :line_referential
has_many :networks, through: :line_referential
- has_many :referential_metadatas
+
+ has_one :referential_metadata
+ accepts_nested_attributes_for :referential_metadata
belongs_to :stop_area_referential
validates_presence_of :stop_area_referential
@@ -145,6 +148,11 @@ class Referential < ActiveRecord::Base
projection_type || ""
end
+ after_create :autocreate_referential_metadata
+ def autocreate_referential_metadata
+ self.create_referential_metadata if workbench
+ end
+
before_create :create_schema
def create_schema
Apartment::Tenant.create slug