[SOLVED - solution on the thread] Hey guys, how is...
# general
d
[SOLVED - solution on the thread] Hey guys, how is it going? I need to add a new feature on the product search (on Admin UI). I have to search by product properties.. these are the properties I have:
Copy code
(0.7ms)  SELECT "spree_properties"."name" FROM "spree_properties"
=> [
  [ 0] "Body",
  [ 1] "Acidity",
  [ 2] "Sweetness",
  [ 3] "Fruit Intensity",
  [ 4] "Oak",
  [ 5] "Tannin",
  [ 6] "Spiciness",
  [ 7] "Color Intensity",
  [ 8] "Earth Notes",
  [ 9] "Vintage",
  [10] "Unit Type"
]
I would like, on the same search, to do something like
Body=4 OR Acidity>4 OR Sweetness<=5
. The current searching engine is Ransack. Any thoughts how to do it?
I had to override the method colletion (from Spree:Admin:ProductsController) and added this search scope:
Copy code
if params[:property].present? && params[:value].present?
      @collection = @collection.with_property_value(params[:property], params[:value])
    end
(unfortunately this search by one property at once)