0

Currently I'm using metasearch gem and I can't figure out how to add 2 conditions for one element in the search form.

Here is my code

f.select :market_product_status_equals, {}.tap { |h| 
  MarketProduct.status.each { |key,value| 
    h[key]= value
  } 
}, :include_blank => true

I wanted to have market_product_status_equals or :market_product_status_is_null

I tried doing this

f.select :market_product_status_equals_or_is_null, {}.tap { |h| 
  MarketProduct.status.each{ |key,value| 
    h[key]= value
  } 
}, :include_blank => true

But it doesn't work

Thanks so much in advance.

HungryCoder
  • 7,506
  • 1
  • 38
  • 51
user648198
  • 2,004
  • 4
  • 19
  • 26

1 Answers1

1
  1. how much code to do this!!! You can get a hash from an array very easily:

    f.select :market_product_status_equals, Hash[MarketProduct.status], :include_blank => true
    
  2. If the available matchers do not fit your needs, just define your own, as in http://erniemiller.org/projects/metasearch/#customizing

rewritten
  • 16,280
  • 2
  • 47
  • 50