From 0bb637b29eb18129de97125ff4bcd7abc7978c1d Mon Sep 17 00:00:00 2001 From: Braulio Bhavamitra Date: Sun, 13 Sep 2015 07:51:42 -0300 Subject: [PATCH] rails4: rename remaining old named_scope --- plugins/bsc/lib/bsc_plugin/contract.rb | 4 ++-- plugins/bsc/lib/bsc_plugin/ext/enterprise.rb | 4 ++-- test/unit/category_test.rb | 2 +- test/unit/person_test.rb | 6 +++--- test/unit/task_test.rb | 2 +- 5 files changed, 9 insertions(+), 9 deletions(-) diff --git a/plugins/bsc/lib/bsc_plugin/contract.rb b/plugins/bsc/lib/bsc_plugin/contract.rb index c7e8270..8cba931 100644 --- a/plugins/bsc/lib/bsc_plugin/contract.rb +++ b/plugins/bsc/lib/bsc_plugin/contract.rb @@ -8,8 +8,8 @@ class BscPlugin::Contract < ActiveRecord::Base belongs_to :bsc, :class_name => 'BscPlugin::Bsc' - named_scope :status, -> status_list { where 'status in (?)', status_list if status_list.present? } - named_scope :sorted_by, -> sorter, direction { order "#{sorter} #{direction}" } + scope :status, -> status_list { where 'status in (?)', status_list if status_list.present? } + scope :sorted_by, -> sorter, direction { order "#{sorter} #{direction}" } before_create do |contract| contract.created_at ||= Time.now.utc diff --git a/plugins/bsc/lib/bsc_plugin/ext/enterprise.rb b/plugins/bsc/lib/bsc_plugin/ext/enterprise.rb index 463c3d5..f68a1a4 100644 --- a/plugins/bsc/lib/bsc_plugin/ext/enterprise.rb +++ b/plugins/bsc/lib/bsc_plugin/ext/enterprise.rb @@ -8,6 +8,6 @@ class Enterprise FIELDS << 'enabled' FIELDS << 'validated' - named_scope :validated, -> { where validated: true } - named_scope :not_validated, -> { where validated: false } + scope :validated, -> { where validated: true } + scope :not_validated, -> { where validated: false } end diff --git a/test/unit/category_test.rb b/test/unit/category_test.rb index bf991bd..e43f81c 100644 --- a/test/unit/category_test.rb +++ b/test/unit/category_test.rb @@ -497,7 +497,7 @@ class CategoryTest < ActiveSupport::TestCase assert_includes Category.on_level(c3), c6 end - should 'on level named_scope must be able to receive parent or parent_id' do + should 'on level scope must be able to receive parent or parent_id' do parent = fast_create(Category) category = fast_create(Category, :parent_id => parent) diff --git a/test/unit/person_test.rb b/test/unit/person_test.rb index 7efc2ff..de9e047 100644 --- a/test/unit/person_test.rb +++ b/test/unit/person_test.rb @@ -1372,7 +1372,7 @@ class PersonTest < ActiveSupport::TestCase assert_includes non_abusers, not_abuser end - should 'admins named_scope return persons who are admin users' do + should 'admins scope return persons who are admin users' do Person.delete_all e = Environment.default admins = [] @@ -1387,7 +1387,7 @@ class PersonTest < ActiveSupport::TestCase assert_equivalent admins, Person.admins end - should 'activated named_scope return persons who are activated users' do + should 'activated scope return persons who are activated users' do Person.delete_all e = Environment.default activated = [] @@ -1403,7 +1403,7 @@ class PersonTest < ActiveSupport::TestCase assert_equivalent activated, Person.activated end - should 'deactivated named_scope return persons who are deactivated users' do + should 'deactivated scope return persons who are deactivated users' do Person.delete_all e = Environment.default deactivated = [] diff --git a/test/unit/task_test.rb b/test/unit/task_test.rb index 6ad69e1..4956983 100644 --- a/test/unit/task_test.rb +++ b/test/unit/task_test.rb @@ -317,7 +317,7 @@ class TaskTest < ActiveSupport::TestCase assert_includes Task.to(another_person), t4 end - should 'filter tasks by type with named_scope' do + should 'filter tasks by type with scope' do class CleanHouse < Task; end class FeedDog < Task; end requestor = fast_create(Person) -- libgit2 0.21.2