TechEmpower Web Framework Benchmarks Round 23
techempower.com4 pointsby jonathanhefner0 comments
class ProductSearch < TalentScout::ModelSearch
criteria(:search) { |search| where("title ILIKE '%?%'", search) }
criteria(:from_price) { |from_price| where("price > ?", from_price) }
criteria(:to_price) { |to_price| where("price < ?", to_price) }
criteria(:properties) { |properties| joins(:product_properties).where(property_id: properties) }
criteria(:category_id) { |category_id| where(category_id: category_id) }
order :price, default: :desc
end
Brevity is an obvious benefit, but reliability even more so. For example, the code in the article has at least two major mistakes: