Class: LesliBell::NotificationsController
- Inherits:
-
ApplicationController
- Object
- Lesli::ApplicationLesliController
- ApplicationController
- LesliBell::NotificationsController
- Defined in:
- app/controllers/lesli_bell/notifications_controller.rb
Instance Method Summary collapse
-
#create ⇒ Object
POST /notifications.
-
#destroy ⇒ Object
DELETE /notifications/1.
-
#edit ⇒ Object
GET /notifications/1/edit.
-
#index ⇒ Object
GET /notifications.
-
#new ⇒ Object
GET /notifications/new.
-
#show ⇒ Object
GET /notifications/1.
-
#update ⇒ Object
PATCH/PUT /notifications/1.
Instance Method Details
#create ⇒ Object
POST /notifications
23 24 25 26 27 28 29 30 31 |
# File 'app/controllers/lesli_bell/notifications_controller.rb', line 23 def create @notification = Notification.new(notification_params) if @notification.save redirect_to @notification, notice: "Notification was successfully created." else render :new, status: :unprocessable_entity end end |
#destroy ⇒ Object
DELETE /notifications/1
41 42 43 44 |
# File 'app/controllers/lesli_bell/notifications_controller.rb', line 41 def destroy @notification.destroy redirect_to notifications_url, notice: "Notification was successfully destroyed.", status: :see_other end |
#edit ⇒ Object
GET /notifications/1/edit
19 20 |
# File 'app/controllers/lesli_bell/notifications_controller.rb', line 19 def edit end |
#index ⇒ Object
GET /notifications
6 7 8 |
# File 'app/controllers/lesli_bell/notifications_controller.rb', line 6 def index @notifications = respond_as_pagination(NotificationService.new(current_user, query).index) end |
#new ⇒ Object
GET /notifications/new
15 16 |
# File 'app/controllers/lesli_bell/notifications_controller.rb', line 15 def new end |
#show ⇒ Object
GET /notifications/1
11 12 |
# File 'app/controllers/lesli_bell/notifications_controller.rb', line 11 def show end |
#update ⇒ Object
PATCH/PUT /notifications/1
34 35 36 37 38 |
# File 'app/controllers/lesli_bell/notifications_controller.rb', line 34 def update NotificationService.new(current_user).read(params[:id]) @notifications = respond_as_pagination(NotificationService.new(current_user, query).index) render :index end |