Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #
- # In your model, you'll want these scopes, so this query logic can be reused elsewhere
- #
- scope :with_make, ->(make) { where(make: make) if make }
- scope :from_year, ->(min_year) { where('year >= ?', min_year) if min_year }
- scope :until_year, ->(max_year) { where('year <= ?', max_year) if max_year }
- scope :above_price, ->(min_selling_price) { where('selling_price >= ?', min_selling_price) if min_selling_price }
- scope :below_price, ->(max_selling_price) { where('selling_price <= ?', max_selling_price) if max_selling_price }
Add Comment
Please, Sign In to add comment