Class: Renalware::HD::Sessions::CloseStaleOpenSessions::CloseableSessionQuery
- Inherits:
-
Object
- Object
- Renalware::HD::Sessions::CloseStaleOpenSessions::CloseableSessionQuery
- Defined in:
- app/models/renalware/hd/sessions/close_stale_open_sessions.rb
Instance Method Summary collapse
Instance Method Details
#each ⇒ Object
15 16 17 18 19 20 21 22 23 24 |
# File 'app/models/renalware/hd/sessions/close_stale_open_sessions.rb', line 15 def each Session::Open .where("performed_on <= ?", performed_before) .where.not(signed_off_by: nil) .find_each do |session| # Note the bang in becomes! is crucial in copying the session attributes # and setting the sti column appropriately yield CloseableSession.new(session.becomes!(Session::Closed)) end end |