diff options
Diffstat (limited to 'app/controllers/alerts_controller.rb')
-rw-r--r-- | app/controllers/alerts_controller.rb | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/app/controllers/alerts_controller.rb b/app/controllers/alerts_controller.rb index a3cb8f9..8f65f3b 100644 --- a/app/controllers/alerts_controller.rb +++ b/app/controllers/alerts_controller.rb @@ -1,6 +1,4 @@ class AlertsController < ApplicationController - before_action :set_alert, only: [:show, :edit, :update, :destroy] - # GET /alerts # GET /alerts.json def index @@ -25,6 +23,13 @@ class AlertsController < ApplicationController # POST /alerts.json def create @alert = Alert.new(alert_params) + @alert.author = current_user + users = {} + users = User.all + + for i in 0..users.length + current_user.send_message(users[i], @alert.message, "Pay Attention!") + end respond_to do |format| if @alert.save @@ -62,6 +67,7 @@ class AlertsController < ApplicationController end private + # Use callbacks to share common setup or constraints between actions. def set_alert @alert = Alert.find(params[:id]) |