From a1eebd42c8b8edb57b2d213f150828b6d9e6f712 Mon Sep 17 00:00:00 2001 From: Ryuta Kamizono Date: Fri, 26 Aug 2016 06:02:52 +0900 Subject: Use splat `options` hash for `has_and_belongs_to_many` For simplicity. --- activerecord/lib/active_record/associations.rb | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) (limited to 'activerecord/lib/active_record/associations.rb') diff --git a/activerecord/lib/active_record/associations.rb b/activerecord/lib/active_record/associations.rb index dc68b01386..7759b0a044 100644 --- a/activerecord/lib/active_record/associations.rb +++ b/activerecord/lib/active_record/associations.rb @@ -1792,12 +1792,7 @@ module ActiveRecord # has_and_belongs_to_many :nations, class_name: "Country" # has_and_belongs_to_many :categories, join_table: "prods_cats" # has_and_belongs_to_many :categories, -> { readonly } - def has_and_belongs_to_many(name, scope = nil, options = {}, &extension) - if scope.is_a?(Hash) - options = scope - scope = nil - end - + def has_and_belongs_to_many(name, scope = nil, **options, &extension) habtm_reflection = ActiveRecord::Reflection::HasAndBelongsToManyReflection.new(name, scope, options, self) builder = Builder::HasAndBelongsToMany.new name, self, options -- cgit v1.2.3