summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeroen van Baarsen <jeroenvanbaarsen@gmail.com>2013-12-09 20:02:36 +0100
committerDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2013-12-10 12:11:28 +0200
commit70bb976bc61c9cd209bbf67520426166664bb539 (patch)
tree9db560a8fb29533e348ac57fdf98a615c6fa79e2
parent2a62aa45cd85f46148e9b5ebcaeaddcff06265e2 (diff)
downloadgitlab-ce-70bb976bc61c9cd209bbf67520426166664bb539.tar.gz
Fixed the last deprecation warnings for order and where
-rw-r--r--app/models/user.rb7
1 files changed, 3 insertions, 4 deletions
diff --git a/app/models/user.rb b/app/models/user.rb
index 76aef38b38a..18f4bbda866 100644
--- a/app/models/user.rb
+++ b/app/models/user.rb
@@ -72,7 +72,7 @@ class User < ActiveRecord::Base
#
# Namespace for personal projects
- has_one :namespace, dependent: :destroy, foreign_key: :owner_id, class_name: "Namespace", conditions: 'type IS NULL'
+ has_one :namespace, -> { where type: nil }, dependent: :destroy, foreign_key: :owner_id, class_name: "Namespace"
# Profile
has_many :keys, dependent: :destroy
@@ -80,8 +80,7 @@ class User < ActiveRecord::Base
# Groups
has_many :users_groups, dependent: :destroy
has_many :groups, through: :users_groups
- has_many :owned_groups, through: :users_groups, source: :group, conditions: { users_groups: { group_access: UsersGroup::OWNER } }
-
+ has_many :owned_groups, -> { where user_group: { group_access: UsersGroup::OWNER } }, through: :users_groups, source: :group
# Projects
has_many :groups_projects, through: :groups, source: :projects
has_many :personal_projects, through: :namespace, source: :projects
@@ -94,7 +93,7 @@ class User < ActiveRecord::Base
has_many :notes, dependent: :destroy, foreign_key: :author_id
has_many :merge_requests, dependent: :destroy, foreign_key: :author_id
has_many :events, dependent: :destroy, foreign_key: :author_id, class_name: "Event"
- has_many :recent_events, foreign_key: :author_id, class_name: "Event", order: "id DESC"
+ has_many :recent_events, -> { order "id DESC" }, foreign_key: :author_id, class_name: "Event"
has_many :assigned_issues, dependent: :destroy, foreign_key: :assignee_id, class_name: "Issue"
has_many :assigned_merge_requests, dependent: :destroy, foreign_key: :assignee_id, class_name: "MergeRequest"