Class: Role::ActionsController

Inherits:
ApplicationController
  • Object
show all
Defined in:
app/controllers/lesli_shield/role/actions_controller.rb

Instance Method Summary collapse

Instance Method Details

#destroyObject



19
20
21
22
23
24
25
26
27
28
29
30
31
# File 'app/controllers/lesli_shield/role/actions_controller.rb', line 19

def destroy
    # check saved
    if @role_action.result.destroy
        # success("Role privileges removed successfully!")
        # respond_to do |format|
        #     format.turbo_stream
        #     #format.html { redirect_to role_path(@role_action.role_id) }
        # end
        return true
    else 
        respond_with_error(@user.errors)
    end
end

#updateObject



5
6
7
8
9
10
11
12
13
14
15
16
17
# File 'app/controllers/lesli_shield/role/actions_controller.rb', line 5

def update
    # check saved
    if @role_action.result.recover
        success("Role privileges added successfully!")
        respond_to do |format|
            format.turbo_stream
            render turbo_stream: turbo_stream.replace("application-lesli-notifications", partial: "lesli/partials/application-lesli-notifications")
            #format.html { redirect_to role_path(@role_action.role_id) }
        end
    else 
        respond_with_error(@user.errors)
    end
end