diff options
| author | Zog | 2018-03-13 14:59:27 +0100 |
|---|---|---|
| committer | Zog | 2018-03-14 09:45:26 +0100 |
| commit | 34e463ce7ae08a08c8106e68544ddf43cc378c8d (patch) | |
| tree | 7bec4387c1bbf54bc44f31552d5b6c8d07eac7e4 /app | |
| parent | 14abadf37b591ec411d08247d3c460cfb0508faa (diff) | |
| download | chouette-core-34e463ce7ae08a08c8106e68544ddf43cc378c8d.tar.bz2 | |
Refs #6107
Binds LineReferentials and StopAreaReferentials to Workgroups, and
enforce uniqueness
Diffstat (limited to 'app')
| -rw-r--r-- | app/models/line_referential.rb | 1 | ||||
| -rw-r--r-- | app/models/stop_area_referential.rb | 1 | ||||
| -rw-r--r-- | app/models/workgroup.rb | 2 |
3 files changed, 4 insertions, 0 deletions
diff --git a/app/models/line_referential.rb b/app/models/line_referential.rb index 15b2f6276..0d2ed39b1 100644 --- a/app/models/line_referential.rb +++ b/app/models/line_referential.rb @@ -10,6 +10,7 @@ class LineReferential < ActiveRecord::Base has_many :networks, class_name: 'Chouette::Network' has_many :line_referential_syncs, -> { order created_at: :desc } has_many :workbenches + has_one :workgroup def add_member(organisation, options = {}) attributes = options.merge organisation: organisation diff --git a/app/models/stop_area_referential.rb b/app/models/stop_area_referential.rb index 54e895cd0..5603399cc 100644 --- a/app/models/stop_area_referential.rb +++ b/app/models/stop_area_referential.rb @@ -6,6 +6,7 @@ class StopAreaReferential < ActiveRecord::Base has_many :stop_areas, class_name: 'Chouette::StopArea' has_many :stop_area_referential_syncs, -> {order created_at: :desc} has_many :workbenches + has_one :workgroup def add_member(organisation, options = {}) attributes = options.merge organisation: organisation diff --git a/app/models/workgroup.rb b/app/models/workgroup.rb index 3af20ae23..708225a2a 100644 --- a/app/models/workgroup.rb +++ b/app/models/workgroup.rb @@ -11,6 +11,8 @@ class Workgroup < ActiveRecord::Base validates_presence_of :line_referential_id validates_presence_of :stop_area_referential_id + validates_uniqueness_of :stop_area_referential_id + validates_uniqueness_of :line_referential_id has_many :custom_fields |
