aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record/associations.rb
diff options
context:
space:
mode:
authorRyuta Kamizono <kamipo@gmail.com>2016-08-26 06:02:52 +0900
committerRyuta Kamizono <kamipo@gmail.com>2016-08-26 06:02:52 +0900
commita1eebd42c8b8edb57b2d213f150828b6d9e6f712 (patch)
tree97bce2d5d75b8a0d96e70310d641fa237cfc5f50 /activerecord/lib/active_record/associations.rb
parent029cbb35352ed79805da1b3a089e724b05bd2a80 (diff)
downloadrails-a1eebd42c8b8edb57b2d213f150828b6d9e6f712.tar.gz
rails-a1eebd42c8b8edb57b2d213f150828b6d9e6f712.tar.bz2
rails-a1eebd42c8b8edb57b2d213f150828b6d9e6f712.zip
Use splat `options` hash for `has_and_belongs_to_many`
For simplicity.
Diffstat (limited to 'activerecord/lib/active_record/associations.rb')
-rw-r--r--activerecord/lib/active_record/associations.rb7
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