diff options
| author | Alban Peignier | 2018-03-26 15:16:22 +0200 |
|---|---|---|
| committer | Alban Peignier | 2018-03-30 13:11:01 +0200 |
| commit | e39d3e055ff61aebe4235492059c6bb7cb1d956f (patch) | |
| tree | 91cd6821fecb9d7dc2ade05b7dd387bb3b23e403 /app/models/line_referential.rb | |
| parent | 9e3b1457d737092fc2b220ac9678407dcafcaf93 (diff) | |
| download | chouette-core-e39d3e055ff61aebe4235492059c6bb7cb1d956f.tar.bz2 | |
Only create new membership when organisation isn't present in #add_member. Refs #6328
Diffstat (limited to 'app/models/line_referential.rb')
| -rw-r--r-- | app/models/line_referential.rb | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/app/models/line_referential.rb b/app/models/line_referential.rb index 0d2ed39b1..89700c06f 100644 --- a/app/models/line_referential.rb +++ b/app/models/line_referential.rb @@ -1,7 +1,7 @@ class LineReferential < ActiveRecord::Base include ObjectidFormatterSupport extend StifTransportModeEnumerations - + has_many :line_referential_memberships has_many :organisations, through: :line_referential_memberships has_many :lines, class_name: 'Chouette::Line' @@ -14,7 +14,7 @@ class LineReferential < ActiveRecord::Base def add_member(organisation, options = {}) attributes = options.merge organisation: organisation - line_referential_memberships.build attributes + line_referential_memberships.build attributes unless organisations.include?(organisation) end validates :name, presence: true |
