Class: NotificationsController
- Inherits:
-
ApplicationController
- Object
- ApplicationController
- NotificationsController
- Defined in:
- lib/generators/simple_notification/templates/notifications_controller.rb
Instance Method Summary collapse
-
#create ⇒ Object
POST /notifications POST /notifications.json.
-
#destroy ⇒ Object
DELETE /notifications/1 DELETE /notifications/1.json.
-
#index ⇒ Object
GET /notifications GET /notifications.json.
Instance Method Details
#create ⇒ Object
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 |
#destroy ⇒ Object
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 |
#index ⇒ Object
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 |