Class: Admin::ApplicationsController

Inherits:
ApplicationController
  • Object
show all
Defined in:
app/controllers/admin/applications_controller.rb

Instance Method Summary collapse

Instance Method Details

#createObject


18
19
20
21
22
23
24
25
26
27
# File 'app/controllers/admin/applications_controller.rb', line 18

def create
  @application = Doorkeeper::Application.new(application_params)

  if @application.save
    flash[:notice] = I18n.t(:notice, scope: [:doorkeeper, :flash, :applications, :create])
    redirect_to admin_application_url(@application)
  else
    render :new
  end
end

#destroyObject


37
38
39
40
# File 'app/controllers/admin/applications_controller.rb', line 37

def destroy
  @application.destroy
  redirect_to admin_applications_url, notice: 'Application was successfully destroyed.'
end

#editObject


15
16
# File 'app/controllers/admin/applications_controller.rb', line 15

def edit
end

#indexObject


4
5
6
# File 'app/controllers/admin/applications_controller.rb', line 4

def index
  @applications = Doorkeeper::Application.where("owner_id IS NULL")
end

#newObject


11
12
13
# File 'app/controllers/admin/applications_controller.rb', line 11

def new
  @application = Doorkeeper::Application.new
end

#showObject


8
9
# File 'app/controllers/admin/applications_controller.rb', line 8

def show
end

#updateObject


29
30
31
32
33
34
35
# File 'app/controllers/admin/applications_controller.rb', line 29

def update
  if @application.update(application_params)
    redirect_to admin_application_path(@application), notice: 'Application was successfully updated.'
  else
    render :edit
  end
end