Commit 70bb976bc61c9cd209bbf67520426166664bb539

Authored by Jeroen van Baarsen
Committed by Dmitriy Zaporozhets
1 parent 2a62aa45

Fixed the last deprecation warnings for order and where

Showing 1 changed file with 3 additions and 4 deletions   Show diff stats
app/models/user.rb
@@ -72,7 +72,7 @@ class User < ActiveRecord::Base @@ -72,7 +72,7 @@ class User < ActiveRecord::Base
72 # 72 #
73 73
74 # Namespace for personal projects 74 # Namespace for personal projects
75 - has_one :namespace, dependent: :destroy, foreign_key: :owner_id, class_name: "Namespace", conditions: 'type IS NULL' 75 + has_one :namespace, -> { where type: nil }, dependent: :destroy, foreign_key: :owner_id, class_name: "Namespace"
76 76
77 # Profile 77 # Profile
78 has_many :keys, dependent: :destroy 78 has_many :keys, dependent: :destroy
@@ -80,8 +80,7 @@ class User < ActiveRecord::Base @@ -80,8 +80,7 @@ class User < ActiveRecord::Base
80 # Groups 80 # Groups
81 has_many :users_groups, dependent: :destroy 81 has_many :users_groups, dependent: :destroy
82 has_many :groups, through: :users_groups 82 has_many :groups, through: :users_groups
83 - has_many :owned_groups, through: :users_groups, source: :group, conditions: { users_groups: { group_access: UsersGroup::OWNER } }  
84 - 83 + has_many :owned_groups, -> { where user_group: { group_access: UsersGroup::OWNER } }, through: :users_groups, source: :group
85 # Projects 84 # Projects
86 has_many :groups_projects, through: :groups, source: :projects 85 has_many :groups_projects, through: :groups, source: :projects
87 has_many :personal_projects, through: :namespace, source: :projects 86 has_many :personal_projects, through: :namespace, source: :projects
@@ -94,7 +93,7 @@ class User < ActiveRecord::Base @@ -94,7 +93,7 @@ class User < ActiveRecord::Base
94 has_many :notes, dependent: :destroy, foreign_key: :author_id 93 has_many :notes, dependent: :destroy, foreign_key: :author_id
95 has_many :merge_requests, dependent: :destroy, foreign_key: :author_id 94 has_many :merge_requests, dependent: :destroy, foreign_key: :author_id
96 has_many :events, dependent: :destroy, foreign_key: :author_id, class_name: "Event" 95 has_many :events, dependent: :destroy, foreign_key: :author_id, class_name: "Event"
97 - has_many :recent_events, foreign_key: :author_id, class_name: "Event", order: "id DESC" 96 + has_many :recent_events, -> { order "id DESC" }, foreign_key: :author_id, class_name: "Event"
98 has_many :assigned_issues, dependent: :destroy, foreign_key: :assignee_id, class_name: "Issue" 97 has_many :assigned_issues, dependent: :destroy, foreign_key: :assignee_id, class_name: "Issue"
99 has_many :assigned_merge_requests, dependent: :destroy, foreign_key: :assignee_id, class_name: "MergeRequest" 98 has_many :assigned_merge_requests, dependent: :destroy, foreign_key: :assignee_id, class_name: "MergeRequest"
100 99