diff options
author | Luca Guidi <guidi.luca@gmail.com> | 2008-10-31 17:28:16 +0100 |
---|---|---|
committer | David Heinemeier Hansson <david@loudthinking.com> | 2008-11-01 15:04:08 +0100 |
commit | 5229fc4cc034ac5f565d143f5fd59ac11ebdc8e3 (patch) | |
tree | 42d56096e958a63b5f3b053970dc112a56914bb1 /activerecord | |
parent | 5110a8e05b760524108bbb387e55c998c0274870 (diff) | |
download | rails-5229fc4cc034ac5f565d143f5fd59ac11ebdc8e3.tar.gz rails-5229fc4cc034ac5f565d143f5fd59ac11ebdc8e3.tar.bz2 rails-5229fc4cc034ac5f565d143f5fd59ac11ebdc8e3.zip |
Make sure habtm use class variable to list association valid keys
Signed-off-by: Michael Koziarski <michael@koziarski.com>
[#1310 state:committed]
Diffstat (limited to 'activerecord')
-rwxr-xr-x | activerecord/lib/active_record/associations.rb | 21 |
1 files changed, 12 insertions, 9 deletions
diff --git a/activerecord/lib/active_record/associations.rb b/activerecord/lib/active_record/associations.rb index 52f6a04da1..84caca3518 100755 --- a/activerecord/lib/active_record/associations.rb +++ b/activerecord/lib/active_record/associations.rb @@ -1596,16 +1596,19 @@ module ActiveRecord reflection end + mattr_accessor :valid_keys_for_has_and_belongs_to_many_association + @@valid_keys_for_has_and_belongs_to_many_association = [ + :class_name, :table_name, :join_table, :foreign_key, :association_foreign_key, + :select, :conditions, :include, :order, :group, :limit, :offset, + :uniq, + :finder_sql, :delete_sql, :insert_sql, + :before_add, :after_add, :before_remove, :after_remove, + :extend, :readonly, + :validate + ] + def create_has_and_belongs_to_many_reflection(association_id, options, &extension) - options.assert_valid_keys( - :class_name, :table_name, :join_table, :foreign_key, :association_foreign_key, - :select, :conditions, :include, :order, :group, :limit, :offset, - :uniq, - :finder_sql, :delete_sql, :insert_sql, - :before_add, :after_add, :before_remove, :after_remove, - :extend, :readonly, - :validate - ) + options.assert_valid_keys(valid_keys_for_has_and_belongs_to_many_association) options[:extend] = create_extension_modules(association_id, extension, options[:extend]) |