From 2e47db2fbd7ea381e3680ffa8ee0ae8547078970 Mon Sep 17 00:00:00 2001 From: David Heinemeier Hansson Date: Wed, 5 Dec 2007 21:53:53 +0000 Subject: Fixed that habtm associations should be able to set :select as part of their definition and have that honored [DHH] git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@8313 5ecf4fe2-1ee6-0310-87b1-e25e094e27de --- activerecord/CHANGELOG | 30 ++-------------------- .../has_and_belongs_to_many_association.rb | 4 +-- 2 files changed, 4 insertions(+), 30 deletions(-) diff --git a/activerecord/CHANGELOG b/activerecord/CHANGELOG index 6ebb9eeea9..b93f6e63d4 100644 --- a/activerecord/CHANGELOG +++ b/activerecord/CHANGELOG @@ -1,5 +1,7 @@ *SVN* +* Fixed that habtm associations should be able to set :select as part of their definition and have that honored [DHH] + * Document how the :include option can be used in Calculations::calculate. Closes #7446 [adamwiggins, ultimoamore] * Fix typo in documentation for polymorphic associations w/STI. Closes #7461 [johnjosephbachir] @@ -8,34 +10,6 @@ * More complete documentation for find_by_sql. Closes #7912 [fearoffish] -* Document API for exists?'s parameter and provide examples of usage. Closes #7913 [fearoffish] - -* Document API for create's attributes parameter and provide examples. Closes #7915 [fearoffish] - -* Documentation for find incorrectly omits the :conditions option from various examples. Closes #7923 [mattwestcott] - -* Document options and add examples for update. Closes #7985 [fearoffish] - -* Document options and add examples for delete. Closes #7986 [fearoffish] - -* Document options and add examples for destroy. Closes #7988 [fearoffish] - -* Document options and add examples for update_all. Closes #7990 [fearoffish] - -* Document options for update_counters. Closes #8091 [fearoffish] - -* Add documentation about the virtual attribute added by validates_confirmation_of and its behavior. Closes #8815 [JEG2, matt, kampers] - -* Add documentation for freeze and readonly related methods. Closes #8878 [pelargir, jeremymcanally] - -* Document the timestamps schema definition method. Closes #9000 [mikong] - -* Give examples for what tables should be called for models inside a module namespace. Closes #10288 [scott_willson] - -* Document the :message option for validates_associated. Closes #10357 [dylans] - -* Document automatically generated predicate methods for attributes. Closes #10373 [chuyeow] - * Added ActiveRecord::Base#becomes to turn a record into one of another class (mostly relevant for STIs) [DHH]. Example: render :partial => @client.becomes(Company) # renders companies/company instead of clients/client diff --git a/activerecord/lib/active_record/associations/has_and_belongs_to_many_association.rb b/activerecord/lib/active_record/associations/has_and_belongs_to_many_association.rb index 3d10721af6..b26ea586e5 100644 --- a/activerecord/lib/active_record/associations/has_and_belongs_to_many_association.rb +++ b/activerecord/lib/active_record/associations/has_and_belongs_to_many_association.rb @@ -47,7 +47,7 @@ module ActiveRecord options[:conditions] = conditions options[:joins] = @join_sql - options[:readonly] = finding_with_ambiguous_select?(options[:select]) + options[:readonly] = finding_with_ambiguous_select?(options[:select] || @reflection.options[:select]) if options[:order] && @reflection.options[:order] options[:order] = "#{options[:order]}, #{@reflection.options[:order]}" @@ -57,7 +57,7 @@ module ActiveRecord merge_options_from_reflection!(options) - options[:select] ||= '*' + options[:select] ||= (@reflection.options[:select] || '*') # Pass through args exactly as we received them. args << options -- cgit v1.2.3