aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord
diff options
context:
space:
mode:
authorOscar Del Ben <info@oscardelben.com>2012-05-14 20:30:34 -0700
committerOscar Del Ben <info@oscardelben.com>2012-05-14 20:30:34 -0700
commit7ecfe3d30ccfaee8dcca4ee649cc006c090bdfb4 (patch)
tree286aaf6a41d6f9db1d2d4d9b205cdc9fea5c8c6a /activerecord
parentc4b00879f00986520e10afcb167bf643fcce07ea (diff)
downloadrails-7ecfe3d30ccfaee8dcca4ee649cc006c090bdfb4.tar.gz
rails-7ecfe3d30ccfaee8dcca4ee649cc006c090bdfb4.tar.bz2
rails-7ecfe3d30ccfaee8dcca4ee649cc006c090bdfb4.zip
Add documentation for arel_table
Diffstat (limited to 'activerecord')
-rw-r--r--activerecord/lib/active_record/core.rb8
1 files changed, 8 insertions, 0 deletions
diff --git a/activerecord/lib/active_record/core.rb b/activerecord/lib/active_record/core.rb
index f5349b0bea..d9cde5d0a3 100644
--- a/activerecord/lib/active_record/core.rb
+++ b/activerecord/lib/active_record/core.rb
@@ -127,10 +127,18 @@ module ActiveRecord
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
+ # 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