Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class CloseEvent
- include Interactor
- delegate :event_type, :trip, :date, to: :context
- def call
- event = trip.last_events[event_type]
- if event.update(ended_at: date)
- context.event = result
- else
- context.fail!(message: 'error to update')
- end
- end
- end
- close_event = CloseEvent.call(event_type: event_type, trip: trip, date: date)
- close_event.event
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement