Class: NotificationsController

Inherits:
ApplicationController
  • Object
show all
Defined in:
lib/generators/simple_notification/templates/notifications_controller.rb

Instance Method Summary collapse

Instance Method Details

#createObject

POST /notifications POST /notifications.json



12
13
14
15
16
# File 'lib/generators/simple_notification/templates/notifications_controller.rb', line 12

def create
  @notification = Notification.new(notification_params)
  @notification.save
  redirect_to :back
end

#destroyObject

DELETE /notifications/1 DELETE /notifications/1.json



20
21
22
23
24
25
26
# File 'lib/generators/simple_notification/templates/notifications_controller.rb', line 20

def destroy
  @notification.destroy
  respond_to do |format|
    format.html { redirect_to :back }
    format.json { head :no_content }
  end
end

#indexObject

GET /notifications GET /notifications.json



6
7
8
# File 'lib/generators/simple_notification/templates/notifications_controller.rb', line 6

def index
  @notifications = Notification.all
end