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
Jérome Perrin
gitlab-ce
Commits
8adf9c79
Commit
8adf9c79
authored
Mar 25, 2013
by
Andrew8xx8
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Additional scopes added
parent
770f262a
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
2 deletions
+5
-2
app/models/snippet.rb
app/models/snippet.rb
+5
-2
No files found.
app/models/snippet.rb
View file @
8adf9c79
...
...
@@ -30,9 +30,12 @@ class Snippet < ActiveRecord::Base
validates
:content
,
presence:
true
# Scopes
scope
:public
,
->
{
where
(
private:
false
)
}
scope
:private
,
->
{
where
(
private:
true
)
}
scope
:fresh
,
->
{
order
(
"created_at DESC"
)
}
scope
:non_expired
,
->
{
where
([
"expires_at IS NULL OR expires_at > ?"
,
Time
.
current
])
}
scope
:expired
,
->
{
where
([
"expires_at IS NOT NULL AND expires_at < ?"
,
Time
.
current
])
}
scope
:has_project
,
->
{
where
(
"bars.id IS NOT NULL"
)
}
scope
:non_expired
,
->
{
where
([
"expires_at IS NULL OR expires_at > ?"
,
Time
.
current
])
}
def
self
.
content_types
[
...
...
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