diff options
| author | Alban Peignier | 2018-01-10 17:45:23 +0100 |
|---|---|---|
| committer | GitHub | 2018-01-10 17:45:23 +0100 |
| commit | df77b06a42277b3c36627a2bfaa84ddf501d9f5f (patch) | |
| tree | 7f3ba79ebb0a9e831749b69cdf03e4b4ec7c6e56 /app/models | |
| parent | e9f9757ea558f90ed125c0284b9cb98539764b75 (diff) | |
| parent | 0bc79220fbce288102ea470fa57f865ee8fdfb47 (diff) | |
| download | chouette-core-df77b06a42277b3c36627a2bfaa84ddf501d9f5f.tar.bz2 | |
Merge pull request #215 from af83/5499-workgroup-model
Provide Workgroup model. Refs #5499
Diffstat (limited to 'app/models')
| -rw-r--r-- | app/models/workbench.rb | 1 | ||||
| -rw-r--r-- | app/models/workgroup.rb | 12 |
2 files changed, 13 insertions, 0 deletions
diff --git a/app/models/workbench.rb b/app/models/workbench.rb index 3190246ae..f49f4e7cf 100644 --- a/app/models/workbench.rb +++ b/app/models/workbench.rb @@ -4,6 +4,7 @@ class Workbench < ActiveRecord::Base belongs_to :line_referential belongs_to :stop_area_referential belongs_to :output, class_name: 'ReferentialSuite' + belongs_to :workgroup has_many :lines, -> (workbench) { Stif::MyWorkbenchScopes.new(workbench).line_scope(self) }, through: :line_referential has_many :networks, through: :line_referential diff --git a/app/models/workgroup.rb b/app/models/workgroup.rb new file mode 100644 index 000000000..bc2831bbd --- /dev/null +++ b/app/models/workgroup.rb @@ -0,0 +1,12 @@ +class Workgroup < ActiveRecord::Base + belongs_to :line_referential + belongs_to :stop_area_referential + + has_many :workbenches + has_many :organisations, through: :workbenches + + validates_uniqueness_of :name + + validates_presence_of :line_referential_id + validates_presence_of :stop_area_referential_id +end |
