Permalink
Browse files

Add documentation for arel_table

  • Loading branch information...
1 parent c4b0087 commit 7ecfe3d30ccfaee8dcca4ee649cc006c090bdfb4 @oscardelben oscardelben committed May 15, 2012
Showing with 8 additions and 0 deletions.
  1. +8 −0 activerecord/lib/active_record/core.rb
@@ -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
@sobrinho
sobrinho May 15, 2012 Contributor

unnecessary end here :)

+ # 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

0 comments on commit 7ecfe3d

Please sign in to comment.