Skip to content

Commit

Permalink
Remove duplicated has_many staging_projects
Browse files Browse the repository at this point in the history
The later staging_projects association was overwriting the correct one.
We also added `autosave: true` missing attribute in the first
association.

Co-authored-by: Eduardo Navarro <enavarro@suse.com>
  • Loading branch information
2 people authored and dmarcoux committed Nov 5, 2018
1 parent 8e497cc commit 9f0329e
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions src/api/app/models/staging_workflow.rb
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
class StagingWorkflow < ApplicationRecord
belongs_to :project, inverse_of: :staging
has_many :staging_projects, class_name: 'Project', inverse_of: :staging_workflow, dependent: :nullify do
has_many :staging_projects, class_name: 'Project', inverse_of: :staging_workflow, dependent: :nullify, autosave: true do
def without_staged_requests
includes(:staged_requests).where(bs_requests: { id: nil })
end
end
has_many :staging_projects, class_name: 'Project', inverse_of: :staging_workflow, dependent: :nullify, autosave: true
has_many :target_of_bs_requests, through: :project
has_many :staged_requests, class_name: 'BsRequest', through: :staging_projects

Expand Down

0 comments on commit 9f0329e

Please sign in to comment.