Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix missing scope in habtm.rb #207

Merged
merged 3 commits into from
Sep 7, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions lib/activerecord-multi-tenant/habtm.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ module ActiveRecord
module Associations
module ClassMethods
# rubocop:disable Naming/PredicateName
def has_and_belongs_to_many_with_tenant(name, options = {}, &extension)
def has_and_belongs_to_many_with_tenant(name, scope = nil, **options, &extension)
# rubocop:enable Naming/PredicateName
has_and_belongs_to_many_without_tenant(name, **options, &extension)
has_and_belongs_to_many_without_tenant(name, scope, **options, &extension)

middle_reflection = _reflections[name.to_s].through_reflection
join_model = middle_reflection.klass
Expand Down
4 changes: 2 additions & 2 deletions spec/schema.rb
Original file line number Diff line number Diff line change
Expand Up @@ -174,8 +174,8 @@ class Project < ActiveRecord::Base
class Manager < ActiveRecord::Base
multi_tenant :account
belongs_to :project
has_and_belongs_to_many :tasks, { tenant_column: :account_id, tenant_enabled: true,
tenant_class_name: 'Account' }
has_and_belongs_to_many :tasks, tenant_column: :account_id, tenant_enabled: true,
tenant_class_name: 'Account'
end

class Task < ActiveRecord::Base
Expand Down