Class: Workarea::Admin::FeaturedProductsSearchViewModel
- Inherits:
-
SearchViewModel
- Object
- SearchViewModel
- Workarea::Admin::FeaturedProductsSearchViewModel
- Defined in:
- app/view_models/workarea/admin/featured_products_search_view_model.rb
Instance Method Summary collapse
-
#browse_option_results ⇒ Object
Yes, I know this is dumb.
- #results ⇒ Object
Instance Method Details
#browse_option_results ⇒ Object
Yes, I know this is dumb. But there seems to be a bug with flat_map and flatten that is driving me fucking crazy and i need to avoid it.
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 |
# File 'app/view_models/workarea/admin/featured_products_search_view_model.rb', line 16 def browse_option_results results = [] persisted_results.each do |model| if model.browses_by_option? model..each do |option| results.push( FeaturedBrowseOptionProductViewModel.wrap( model, (model).merge( model.browse_option => option.optionize ) ) ) end else results.push( FeaturedBrowseOptionProductViewModel.wrap( model, (model) ) ) end end results end |
#results ⇒ Object
4 5 6 7 8 9 10 11 |
# File 'app/view_models/workarea/admin/featured_products_search_view_model.rb', line 4 def results @results ||= PagedArray.from( browse_option_results, model.results.page, model.results.per_page, total ) end |