aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record/relation
diff options
context:
space:
mode:
authorAkira Matsuda <ronnie@dio.jp>2016-12-23 15:51:11 +0900
committerAkira Matsuda <ronnie@dio.jp>2016-12-24 23:39:36 +0900
commit5b14129d8d4ad302b4e11df6bd5c7891b75f393c (patch)
treecfcd0a51846f540f40cc314e29a7070b415a9219 /activerecord/lib/active_record/relation
parent6c5bbb4b7d3bdd1b43e512fb6ae764c373c7827b (diff)
downloadrails-5b14129d8d4ad302b4e11df6bd5c7891b75f393c.tar.gz
rails-5b14129d8d4ad302b4e11df6bd5c7891b75f393c.tar.bz2
rails-5b14129d8d4ad302b4e11df6bd5c7891b75f393c.zip
Privatize unneededly protected methods in Active Record
Diffstat (limited to 'activerecord/lib/active_record/relation')
-rw-r--r--activerecord/lib/active_record/relation/delegation.rb2
-rw-r--r--activerecord/lib/active_record/relation/finder_methods.rb22
2 files changed, 11 insertions, 13 deletions
diff --git a/activerecord/lib/active_record/relation/delegation.rb b/activerecord/lib/active_record/relation/delegation.rb
index 4b9310b225..43dac0ed3d 100644
--- a/activerecord/lib/active_record/relation/delegation.rb
+++ b/activerecord/lib/active_record/relation/delegation.rb
@@ -78,7 +78,7 @@ module ActiveRecord
end
end
- protected
+ private
def method_missing(method, *args, &block)
if @klass.respond_to?(method)
diff --git a/activerecord/lib/active_record/relation/finder_methods.rb b/activerecord/lib/active_record/relation/finder_methods.rb
index 5e456452e9..d74f15d479 100644
--- a/activerecord/lib/active_record/relation/finder_methods.rb
+++ b/activerecord/lib/active_record/relation/finder_methods.rb
@@ -439,9 +439,9 @@ module ActiveRecord
reflections.none?(&:collection?)
end
- protected
+ private
- def find_with_ids(*ids)
+ def find_with_ids(*ids) # :doc:
raise UnknownPrimaryKey.new(@klass) if primary_key.nil?
expects_array = ids.first.kind_of?(Array)
@@ -462,7 +462,7 @@ module ActiveRecord
raise RecordNotFound, "Couldn't find #{@klass.name} with an out of range ID"
end
- def find_one(id)
+ def find_one(id) # :doc:
if ActiveRecord::Base === id
id = id.id
ActiveSupport::Deprecation.warn(<<-MSG.squish)
@@ -479,7 +479,7 @@ module ActiveRecord
record
end
- def find_some(ids)
+ def find_some(ids) # :doc:
return find_some_ordered(ids) unless order_values.present?
result = where(primary_key => ids).to_a
@@ -503,7 +503,7 @@ module ActiveRecord
end
end
- def find_some_ordered(ids)
+ def find_some_ordered(ids) # :doc:
ids = ids.slice(offset_value || 0, limit_value || ids.size) || []
result = except(:limit, :offset).where(primary_key => ids).records
@@ -518,7 +518,7 @@ module ActiveRecord
end
end
- def find_take
+ def find_take # :doc:
if loaded?
records.first
else
@@ -526,7 +526,7 @@ module ActiveRecord
end
end
- def find_take_with_limit(limit)
+ def find_take_with_limit(limit) # :doc:
if loaded?
records.take(limit)
else
@@ -534,11 +534,11 @@ module ActiveRecord
end
end
- def find_nth(index)
+ def find_nth(index) # :doc:
@offsets[offset_index + index] ||= find_nth_with_limit(index, 1).first
end
- def find_nth_with_limit(index, limit)
+ def find_nth_with_limit(index, limit) # :doc:
if loaded?
records[index, limit] || []
else
@@ -553,7 +553,7 @@ module ActiveRecord
end
end
- def find_nth_from_last(index)
+ def find_nth_from_last(index) # :doc:
if loaded?
records[-index]
else
@@ -572,8 +572,6 @@ module ActiveRecord
end
end
- private
-
def find_last(limit)
limit ? records.last(limit) : records.last
end