Skip to content

Commit

Permalink
Add documentation for arel_table
Browse files Browse the repository at this point in the history
  • Loading branch information
oscardelben committed May 15, 2012
1 parent c4b0087 commit 7ecfe3d
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions activerecord/lib/active_record/core.rb
Original file line number Diff line number Diff line change
Expand Up @@ -127,10 +127,18 @@ def ===(object)
object.is_a?(self)
end

# Returns an instance of +Arel::Table+ loaded with the curent
# table name
#
# class Post < ActiveRecord::Base
# scope :published_and_commented, published.and(self.arel_table[:comments_count].gt(0))
# end

This comment has been minimized.

Copy link
@sobrinho

sobrinho May 15, 2012

Contributor

unnecessary end here :)

This comment has been minimized.

Copy link
@carlosantoniodasilva

carlosantoniodasilva May 15, 2012

Member

Fixed in e3cc49c, thanks!

# end
def arel_table
@arel_table ||= Arel::Table.new(table_name, arel_engine)
end

# Returns the Arel engine
def arel_engine
@arel_engine ||= connection_handler.retrieve_connection_pool(self) ? self : active_record_super.arel_engine
end
Expand Down

0 comments on commit 7ecfe3d

Please sign in to comment.