Skip to content

Commit

Permalink
Fixes rubocop warnings (#246)
Browse files Browse the repository at this point in the history
  • Loading branch information
ykarakita authored Aug 2, 2024
1 parent 56fac92 commit bfdb5ce
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 8 deletions.
3 changes: 3 additions & 0 deletions .rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@ Lint/ConstantDefinitionInBlock:
Lint/EmptyBlock:
Enabled: false

Lint/ShadowedArgument:
IgnoreImplicitReferences: true

Style/ClassAndModuleChildren:
Enabled: false

Expand Down
2 changes: 1 addition & 1 deletion lib/activerecord-multi-tenant/model_extensions.rb
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ def skip_statement_cache?(*scope)
return true if through_klass.respond_to?(:scoped_by_tenant?) && through_klass.scoped_by_tenant?
end

super(*scope)
super
end
end
end
Expand Down
14 changes: 7 additions & 7 deletions lib/activerecord-multi-tenant/query_rewriter.rb
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ def initialize(arel)
def visit_Arel_Attributes_Attribute(*args)
return if @current_context.nil?

super(*args)
super
end

def visit_Arel_Nodes_Equality(obj, *args)
Expand All @@ -91,7 +91,7 @@ def visit_Arel_Nodes_Equality(obj, *args)
@current_context.visited_handled_relation(obj.left.relation)
end
end
super(obj, *args)
super
end

def visit_MultiTenant_TenantEnforcementClause(obj, *)
Expand Down Expand Up @@ -244,7 +244,7 @@ def visit_MultiTenant_TenantJoinEnforcementClause(obj, collector)

module DatabaseStatements
def join_to_update(update, *args)
update = super(update, *args)
update = super
model = MultiTenant.multi_tenant_model_for_table(MultiTenant::TableNode.table_name(update.ast.relation))
if model.present? && !MultiTenant.with_write_only_mode_enabled? && MultiTenant.current_tenant_id.present?
update.where(MultiTenant::TenantEnforcementClause.new(model.arel_table[model.partition_key]))
Expand All @@ -253,7 +253,7 @@ def join_to_update(update, *args)
end

def join_to_delete(delete, *args)
delete = super(delete, *args)
delete = super
model = MultiTenant.multi_tenant_model_for_table(MultiTenant::TableNode.table_name(delete.ast.left))
if model.present? && !MultiTenant.with_write_only_mode_enabled? && MultiTenant.current_tenant_id.present?
delete.where(MultiTenant::TenantEnforcementClause.new(model.arel_table[model.partition_key]))
Expand All @@ -266,15 +266,15 @@ def update(arel, name = nil, binds = [])
if model.present? && !MultiTenant.with_write_only_mode_enabled? && MultiTenant.current_tenant_id.present?
arel.where(MultiTenant::TenantEnforcementClause.new(model.arel_table[model.partition_key]))
end
super(arel, name, binds)
super
end

def delete(arel, name = nil, binds = [])
model = MultiTenant.multi_tenant_model_for_arel(arel)
if model.present? && !MultiTenant.with_write_only_mode_enabled? && MultiTenant.current_tenant_id.present?
arel.where(MultiTenant::TenantEnforcementClause.new(model.arel_table[model.partition_key]))
end
super(arel, name, binds)
super
end
end
end
Expand Down Expand Up @@ -379,7 +379,7 @@ def cached_find_by_statement(key, &block)
return super unless respond_to?(:scoped_by_tenant?) && scoped_by_tenant?

key = Array.wrap(key) + [MultiTenant.current_tenant_id.to_s]
super(key, &block)
super
end
end

Expand Down

0 comments on commit bfdb5ce

Please sign in to comment.