Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Léo-Paul Géneau
gitlab-ce
Commits
49c12f9b
Commit
49c12f9b
authored
Jan 28, 2019
by
Sean McGivern
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'ce-1979-2-1' into 'master'
Add query method for id See merge request gitlab-org/gitlab-ce!24386
parents
91e97c80
d253440e
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
19 additions
and
2 deletions
+19
-2
app/models/application_record.rb
app/models/application_record.rb
+4
-0
app/models/namespace.rb
app/models/namespace.rb
+1
-1
app/models/user.rb
app/models/user.rb
+1
-1
spec/models/application_record_spec.rb
spec/models/application_record_spec.rb
+13
-0
No files found.
app/models/application_record.rb
View file @
49c12f9b
...
...
@@ -2,4 +2,8 @@
class
ApplicationRecord
<
ActiveRecord
::
Base
self
.
abstract_class
=
true
def
self
.
id_in
(
ids
)
where
(
id:
ids
)
end
end
app/models/namespace.rb
View file @
49c12f9b
# frozen_string_literal: true
class
Namespace
<
A
ctiveRecord
::
Base
class
Namespace
<
A
pplicationRecord
include
CacheMarkdownField
include
Sortable
include
Gitlab
::
VisibilityLevel
...
...
app/models/user.rb
View file @
49c12f9b
...
...
@@ -2,7 +2,7 @@
require
'carrierwave/orm/activerecord'
class
User
<
A
ctiveRecord
::
Base
class
User
<
A
pplicationRecord
extend
Gitlab
::
ConfigHelper
include
Gitlab
::
ConfigHelper
...
...
spec/models/application_record_spec.rb
0 → 100644
View file @
49c12f9b
# frozen_string_literal: true
require
'spec_helper'
describe
ApplicationRecord
do
describe
'#id_in'
do
let
(
:records
)
{
create_list
(
:user
,
3
)
}
it
'returns records of the ids'
do
expect
(
User
.
id_in
(
records
.
last
(
2
).
map
(
&
:id
))).
to
eq
(
records
.
last
(
2
))
end
end
end
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment