diff options
Diffstat (limited to 'app')
| -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 |
