mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
Make arel methods private API
Since its conception arel was made to be private API of Active Record. If users want to use arel features directly we should provide a way using the Active Record API without exposing the arel implementation.
This commit is contained in:
parent
83ea905fd1
commit
cd93d7175e
2 changed files with 5 additions and 6 deletions
|
@ -138,12 +138,12 @@ module ActiveRecord
|
|||
# class Post < ActiveRecord::Base
|
||||
# scope :published_and_commented, -> { published.and(self.arel_table[:comments_count].gt(0)) }
|
||||
# end
|
||||
def arel_table
|
||||
def arel_table # :nodoc:
|
||||
@arel_table ||= Arel::Table.new(table_name, arel_engine)
|
||||
end
|
||||
|
||||
# Returns the Arel engine.
|
||||
def arel_engine
|
||||
def arel_engine # :nodoc:
|
||||
@arel_engine ||=
|
||||
if Base == self || connection_handler.retrieve_connection_pool(self)
|
||||
self
|
||||
|
|
|
@ -824,11 +824,12 @@ module ActiveRecord
|
|||
end
|
||||
|
||||
# Returns the Arel object associated with the relation.
|
||||
def arel
|
||||
def arel # :nodoc:
|
||||
@arel ||= build_arel
|
||||
end
|
||||
|
||||
# Like #arel, but ignores the default scope of the model.
|
||||
private
|
||||
|
||||
def build_arel
|
||||
arel = Arel::SelectManager.new(table.engine, table)
|
||||
|
||||
|
@ -854,8 +855,6 @@ module ActiveRecord
|
|||
arel
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def symbol_unscoping(scope)
|
||||
if !VALID_UNSCOPING_VALUES.include?(scope)
|
||||
raise ArgumentError, "Called unscope() with invalid unscoping argument ':#{scope}'. Valid arguments are :#{VALID_UNSCOPING_VALUES.to_a.join(", :")}."
|
||||
|
|
Loading…
Reference in a new issue