SHARE
TWEET

Untitled

a guest Sep 3rd, 2019 81 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.  scope :filter_on_start_date, lambda { |date_start = nil, date_end = nil|
  2.     if date_start.present? && date_end.present?
  3.       where('start_at >= :start and start_at <= :end', start: date_start, end: date_end)
  4.     elsif date_start.present?
  5.       where('start_at >= :start', start: date_start)
  6.     elsif date_end.present?
  7.       where('start_at <= :end', end: date_end)
  8.     else
  9.       all
  10.     end
  11.   }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top