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
28 29 30 31 32 33 34 35 36 |
# File 'app/controllers/lesli_bell/notifications_controller.rb', line 28 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
48 49 50 51 |
# File 'app/controllers/lesli_bell/notifications_controller.rb', line 48 def destroy @notification.destroy redirect_to notifications_url, notice: "Notification was successfully destroyed.", status: :see_other end |
#edit ⇒ Object
GET /notifications/1/edit
24 25 |
# File 'app/controllers/lesli_bell/notifications_controller.rb', line 24 def edit end |
#index ⇒ Object
GET /notifications
6 7 8 9 10 11 12 13 |
# File 'app/controllers/lesli_bell/notifications_controller.rb', line 6 def index respond_to do |format| format.html { } format.json { respond_with_pagination(NotificationService.new(current_user, query).index) } end end |
#new ⇒ Object
GET /notifications/new
20 21 |
# File 'app/controllers/lesli_bell/notifications_controller.rb', line 20 def new end |
#show ⇒ Object
GET /notifications/1
16 17 |
# File 'app/controllers/lesli_bell/notifications_controller.rb', line 16 def show end |
#update ⇒ Object
PATCH/PUT /notifications/1
39 40 41 42 43 44 45 |
# File 'app/controllers/lesli_bell/notifications_controller.rb', line 39 def update if @notification.update(notification_params) redirect_to @notification, notice: "Notification was successfully updated.", status: :see_other else render :edit, status: :unprocessable_entity end end |