summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarin Jankovski <marin@gitlab.com>2014-06-04 08:37:19 +0200
committerMarin Jankovski <marin@gitlab.com>2014-06-04 08:37:19 +0200
commit18b1f171bd0b9700e73c37c23150bea9fb251b3e (patch)
tree5c461f95d6b5b50b75edb4946ea8b980318e7dfe
parent84dc9cd6926ea8bc4db533e658463b4e60f68e6b (diff)
downloadgitlab-ce-18b1f171bd0b9700e73c37c23150bea9fb251b3e.tar.gz
Rename snippets scopes to plural names.
-rw-r--r--app/controllers/snippets_controller.rb12
-rw-r--r--app/models/snippet.rb4
-rw-r--r--app/views/snippets/current_user_index.html.haml12
-rw-r--r--config/initializers/state_machine_patch.rb6
4 files changed, 17 insertions, 17 deletions
diff --git a/app/controllers/snippets_controller.rb b/app/controllers/snippets_controller.rb
index 89edd9fd7e1..4fe98f804dc 100644
--- a/app/controllers/snippets_controller.rb
+++ b/app/controllers/snippets_controller.rb
@@ -14,7 +14,7 @@ class SnippetsController < ApplicationController
layout 'navless'
def index
- @snippets = Snippet.is_public.fresh.non_expired.page(params[:page]).per(20)
+ @snippets = Snippet.are_public.fresh.non_expired.page(params[:page]).per(20)
end
def user_index
@@ -26,15 +26,15 @@ class SnippetsController < ApplicationController
if @user == current_user
@snippets = case params[:scope]
- when 'is_public' then
- @snippets.is_public
- when 'is_private' then
- @snippets.is_private
+ when 'are_public' then
+ @snippets.are_public
+ when 'are_private' then
+ @snippets.are_private
else
@snippets
end
else
- @snippets = @snippets.is_public
+ @snippets = @snippets.are_public
end
@snippets = @snippets.page(params[:page]).per(20)
diff --git a/app/models/snippet.rb b/app/models/snippet.rb
index 0727bb16398..9e4409daa1a 100644
--- a/app/models/snippet.rb
+++ b/app/models/snippet.rb
@@ -34,8 +34,8 @@ class Snippet < ActiveRecord::Base
validates :content, presence: true
# Scopes
- scope :is_public, -> { where(private: false) }
- scope :is_private, -> { where(private: true) }
+ scope :are_public, -> { where(private: false) }
+ scope :are_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]) }
diff --git a/app/views/snippets/current_user_index.html.haml b/app/views/snippets/current_user_index.html.haml
index 3e030428701..e3edd856983 100644
--- a/app/views/snippets/current_user_index.html.haml
+++ b/app/views/snippets/current_user_index.html.haml
@@ -18,16 +18,16 @@
All
%span.pull-right
= @user.snippets.count
- = nav_tab :scope, 'is_private' do
- = link_to user_snippets_path(@user, scope: 'is_private') do
+ = nav_tab :scope, 'are_private' do
+ = link_to user_snippets_path(@user, scope: 'are_private') do
Private
%span.pull-right
- = @user.snippets.is_private.count
- = nav_tab :scope, 'is_public' do
- = link_to user_snippets_path(@user, scope: 'is_public') do
+ = @user.snippets.are_private.count
+ = nav_tab :scope, 'are_public' do
+ = link_to user_snippets_path(@user, scope: 'are_public') do
Public
%span.pull-right
- = @user.snippets.is_public.count
+ = @user.snippets.are_public.count
.col-md-9.my-snippets
= render 'snippets'
diff --git a/config/initializers/state_machine_patch.rb b/config/initializers/state_machine_patch.rb
index a446b6275c4..72d010fa5de 100644
--- a/config/initializers/state_machine_patch.rb
+++ b/config/initializers/state_machine_patch.rb
@@ -2,8 +2,8 @@
# where gem 'state_machine' was not working for Rails 4.1
module StateMachine
module Integrations
- module ActiveModel
- public :around_validation
- end
+ module ActiveModel
+ public :around_validation
+ end
end
end