Class: LesliBell::NotificationsController

Inherits:
ApplicationController show all
Defined in:
app/controllers/lesli_bell/notifications_controller.rb

Instance Method Summary collapse

Instance Method Details

#createObject

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

#destroyObject

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

#editObject

GET /notifications/1/edit



24
25
# File 'app/controllers/lesli_bell/notifications_controller.rb', line 24

def edit
end

#indexObject

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

#newObject

GET /notifications/new



20
21
# File 'app/controllers/lesli_bell/notifications_controller.rb', line 20

def new
end

#showObject

GET /notifications/1



16
17
# File 'app/controllers/lesli_bell/notifications_controller.rb', line 16

def show
end

#updateObject

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