Browse Source

AR uniq deprecated in Rails 5.

git-svn-id: http://svn.redmine.org/redmine/trunk@16598 e93f8b46-1217-0410-a6f0-8f06a7374b81
tags/3.4.0
Jean-Philippe Lang 7 years ago
parent
commit
58dc4455cb
2 changed files with 2 additions and 2 deletions
  1. 1
    1
      app/controllers/workflows_controller.rb
  2. 1
    1
      app/models/user.rb

+ 1
- 1
app/controllers/workflows_controller.rb View File

role_ids = Role.all.select(&:consider_workflow?).map(&:id) role_ids = Role.all.select(&:consider_workflow?).map(&:id)
status_ids = WorkflowTransition.where( status_ids = WorkflowTransition.where(
:tracker_id => @trackers.map(&:id), :role_id => role_ids :tracker_id => @trackers.map(&:id), :role_id => role_ids
).uniq.pluck(:old_status_id, :new_status_id).flatten.uniq
).distinct.pluck(:old_status_id, :new_status_id).flatten.uniq
@statuses = IssueStatus.where(:id => status_ids).sorted.to_a.presence @statuses = IssueStatus.where(:id => status_ids).sorted.to_a.presence
end end
@statuses ||= IssueStatus.sorted.to_a @statuses ||= IssueStatus.sorted.to_a

+ 1
- 1
app/models/user.rb View File

end end


def roles def roles
@roles ||= Role.joins(members: :project).where(["#{Project.table_name}.status <> ?", Project::STATUS_ARCHIVED]).where(Member.arel_table[:user_id].eq(id)).uniq
@roles ||= Role.joins(members: :project).where(["#{Project.table_name}.status <> ?", Project::STATUS_ARCHIVED]).where(Member.arel_table[:user_id].eq(id)).distinct
end end


# Returns the user's bult-in role # Returns the user's bult-in role

Loading…
Cancel
Save