saucy/app/controllers/notifications_controller.rb

26 lines
629 B
Ruby
Raw Normal View History

2022-07-16 10:27:43 +00:00
class NotificationsController < ApplicationController
before_action :require_login
2022-10-06 14:50:38 +00:00
before_action :set_notification, only: [:deliver]
# GET /notifications
def index
@scheduled = Notification.where(status: 'scheduled').order(to_be_sent_on: :asc)
@sent = Notification.where(status: 'sent').order(sent_at: :desc)
end
2022-07-16 10:27:43 +00:00
# POST /notifications/1/deliver
def deliver
@notification.deliver!
redirect_to @notification.member
end
private
# Use callbacks to share common setup or constraints between actions.
def set_notification
@notification = Notification.find(params[:id])
end
end