diff options
author | Sean Griffin <sean@seantheprogrammer.com> | 2016-08-31 10:07:02 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-08-31 10:07:02 -0400 |
commit | eabfce4d600a3bdb1395a636f868f1ef08463486 (patch) | |
tree | 09d9094d45052ca9b2f43eeb9b562c3d9dc862b7 /activerecord | |
parent | c14c0e3cf0f4fd828411b42602a6e7a71e0d59c7 (diff) | |
parent | a1eebd42c8b8edb57b2d213f150828b6d9e6f712 (diff) | |
download | rails-eabfce4d600a3bdb1395a636f868f1ef08463486.tar.gz rails-eabfce4d600a3bdb1395a636f868f1ef08463486.tar.bz2 rails-eabfce4d600a3bdb1395a636f868f1ef08463486.zip |
Merge pull request #26283 from kamipo/use_splat_hash_for_options
Use splat `options` hash for `has_and_belongs_to_many`
Diffstat (limited to 'activerecord')
-rw-r--r-- | activerecord/lib/active_record/associations.rb | 7 |
1 files changed, 1 insertions, 6 deletions
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 |