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
Boxiang Sun
gitlab-ce
Commits
90c2e0d9
Commit
90c2e0d9
authored
May 30, 2014
by
Marin Jankovski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Replace now forbidden keywords public and private for snippets scope
parent
51d5e4cd
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
3 additions
and
3 deletions
+3
-3
app/controllers/snippets_controller.rb
app/controllers/snippets_controller.rb
+1
-1
app/models/snippet.rb
app/models/snippet.rb
+2
-2
No files found.
app/controllers/snippets_controller.rb
View file @
90c2e0d9
...
...
@@ -14,7 +14,7 @@ class SnippetsController < ApplicationController
layout
'navless'
def
index
@snippets
=
Snippet
.
public
.
fresh
.
non_expired
.
page
(
params
[
:page
]).
per
(
20
)
@snippets
=
Snippet
.
is_
public
.
fresh
.
non_expired
.
page
(
params
[
:page
]).
per
(
20
)
end
def
user_index
...
...
app/models/snippet.rb
View file @
90c2e0d9
...
...
@@ -34,8 +34,8 @@ class Snippet < ActiveRecord::Base
validates
:content
,
presence:
true
# Scopes
scope
:public
,
->
{
where
(
private:
false
)
}
scope
:private
,
->
{
where
(
private:
true
)
}
scope
:
is_
public
,
->
{
where
(
private:
false
)
}
scope
:
is_
private
,
->
{
where
(
private:
true
)
}
scope
:fresh
,
->
{
order
(
"created_at DESC"
)
}
scope
:expired
,
->
{
where
([
"expires_at IS NOT NULL AND expires_at < ?"
,
Time
.
current
])
}
scope
:non_expired
,
->
{
where
([
"expires_at IS NULL OR expires_at > ?"
,
Time
.
current
])
}
...
...
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