Class: FestivityMarketList
- Inherits:
-
Object
- Object
- FestivityMarketList
- Includes:
- Concerns::FestivitySqlBuilder
- Defined in:
- app/models/festivity_market_list.rb
Defined Under Namespace
Classes: FestivityMarketDetail
Instance Attribute Summary collapse
-
#markets ⇒ Object
readonly
Returns the value of attribute markets.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(market_details) ⇒ FestivityMarketList
constructor
A new instance of FestivityMarketList.
Constructor Details
#initialize(market_details) ⇒ FestivityMarketList
8 9 10 |
# File 'app/models/festivity_market_list.rb', line 8 def initialize(market_details) @markets = market_details end |
Instance Attribute Details
#markets ⇒ Object (readonly)
Returns the value of attribute markets.
5 6 7 |
# File 'app/models/festivity_market_list.rb', line 5 def markets @markets end |
Class Method Details
.search(criteria, order_by) ⇒ Object
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'app/models/festivity_market_list.rb', line 12 def self.search(criteria, order_by) begin where_clause = parse_criteria(criteria) rescue ActiveRecord::RecordNotFound return FestivityMarketList.new([]) end # where in market ids FestivityMarketList.new( FestivityMarketList::FestivityMarketDetail. includes(:assets). joins(:festivity_categories). where(where_clause). order("#{order_by} ASC"). preload(:festivity_categories) ) end |