aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record/base.rb
diff options
context:
space:
mode:
authorJon Leighton <j@jonathanleighton.com>2011-03-05 22:58:48 +0000
committerJon Leighton <j@jonathanleighton.com>2011-03-05 22:58:48 +0000
commit28ed10d3f27e27ed105dd8fd60d6151a6b372375 (patch)
treeca2cfb5696cbc9de3d636212374eaeafafa23c39 /activerecord/lib/active_record/base.rb
parentb7f1b3641afe0ff4f3cd344815c6f7bb58821e9e (diff)
parent74818a35432b40fef16fe74f248ea75d35405324 (diff)
downloadrails-28ed10d3f27e27ed105dd8fd60d6151a6b372375.tar.gz
rails-28ed10d3f27e27ed105dd8fd60d6151a6b372375.tar.bz2
rails-28ed10d3f27e27ed105dd8fd60d6151a6b372375.zip
Merge branch 'master' into nested_has_many_through
Conflicts: activerecord/CHANGELOG
Diffstat (limited to 'activerecord/lib/active_record/base.rb')
-rw-r--r--activerecord/lib/active_record/base.rb6
1 files changed, 3 insertions, 3 deletions
diff --git a/activerecord/lib/active_record/base.rb b/activerecord/lib/active_record/base.rb
index baf82bedd3..7f506faeee 100644
--- a/activerecord/lib/active_record/base.rb
+++ b/activerecord/lib/active_record/base.rb
@@ -463,7 +463,7 @@ module ActiveRecord #:nodoc:
#
# # You can use the same string replacement techniques as you can with ActiveRecord#find
# Post.find_by_sql ["SELECT title FROM posts WHERE author = ? AND created > ?", author_id, start_date]
- # > [#<Post:0x36bff9c @attributes={"first_name"=>"The Cheap Man Buys Twice"}>, ...]
+ # > [#<Post:0x36bff9c @attributes={"title"=>"The Cheap Man Buys Twice"}>, ...]
def find_by_sql(sql, binds = [])
connection.select_all(sanitize_sql(sql), "#{name} Load", binds).collect! { |record| instantiate(record) }
end
@@ -636,7 +636,7 @@ module ActiveRecord #:nodoc:
@quoted_table_name = nil
define_attr_method :table_name, value, &block
- @arel_table = Arel::Table.new(table_name, :engine => arel_engine)
+ @arel_table = Arel::Table.new(table_name, arel_engine)
@relation = Relation.new(self, arel_table)
end
alias :table_name= :set_table_name
@@ -1321,7 +1321,7 @@ MSG
def sanitize_sql_hash_for_conditions(attrs, default_table_name = self.table_name)
attrs = expand_hash_conditions_for_aggregates(attrs)
- table = Arel::Table.new(self.table_name, :engine => arel_engine, :as => default_table_name)
+ table = Arel::Table.new(table_name).alias(default_table_name)
viz = Arel::Visitors.for(arel_engine)
PredicateBuilder.build_from_hash(arel_engine, attrs, table).map { |b|
viz.accept b