-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Extract the ransack patch to a separate file
- Loading branch information
Showing
3 changed files
with
19 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,3 @@ | ||
# frozen_string_literal: true | ||
|
||
require 'spree_core' | ||
|
||
class Arel::Table | ||
def table_name | ||
name | ||
end | ||
end | ||
|
||
|
||
module RansackNodeConditionPatch | ||
private | ||
|
||
def casted_array?(predicate) | ||
predicate.is_a?(Arel::Nodes::Casted) && predicate.value.is_a?(Array) | ||
end | ||
|
||
Ransack::Nodes::Condition.prepend(self) | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
# frozen_string_literal: true | ||
|
||
require "ransack/version" | ||
|
||
return unless Ransack::VERSION.start_with?("4.1.") | ||
|
||
module RansackNodeConditionPatch | ||
private | ||
|
||
# Waiting for https://github.com/activerecord-hackery/ransack/pull/1468 | ||
def casted_array?(predicate) | ||
predicate.is_a?(Arel::Nodes::Casted) && predicate.value.is_a?(Array) | ||
end | ||
|
||
Ransack::Nodes::Condition.prepend(self) | ||
end |