Skip to content

Commit

Permalink
Move logic to private methods
Browse files Browse the repository at this point in the history
  • Loading branch information
Willian van der Velde committed May 14, 2024
1 parent 85ebd2c commit 4697c85
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions lib/arel/middleware/chain.rb
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,11 @@ def to_sql(type, &block)

private

def enhance_arel(sql, binds)
arel = Arel.sql_to_arel(sql, binds: binds)
Arel.enhance(arel)
end

def execute_with_middleware(sql, binds, execute_sql)
check_middleware_recursion(sql)

Expand All @@ -124,8 +129,7 @@ def execute_with_middleware(sql, binds, execute_sql)
cache_accessor: cache_accessor,
)

arel = Arel.sql_to_arel(sql, binds: binds)
enhanced_arel = Arel.enhance(arel)
enhanced_arel = enhance_arel sql, binds

executor.run(enhanced_arel, updated_context, execute_sql)
end
Expand Down

0 comments on commit 4697c85

Please sign in to comment.