Skip to content

Commit

Permalink
Make sure habtm use class variable to list association valid keys
Browse files Browse the repository at this point in the history
Signed-off-by: Michael Koziarski <michael@koziarski.com>
[#1310 state:committed]
  • Loading branch information
Luca Guidi authored and NZKoz committed Nov 1, 2008
1 parent 5110a8e commit 3f6653f
Showing 1 changed file with 12 additions and 9 deletions.
21 changes: 12 additions & 9 deletions activerecord/lib/active_record/associations.rb
Expand Up @@ -1596,16 +1596,19 @@ def create_belongs_to_reflection(association_id, options)
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])

Expand Down

0 comments on commit 3f6653f

Please sign in to comment.