Class: OAuth::ApplicationsController

Inherits:
Doorkeeper::ApplicationsController
  • Object
show all
Defined in:
app/controllers/oauth/applications_controller.rb

Instance Method Summary collapse

Instance Method Details

#createObject


13
14
15
16
17
18
19
20
21
# File 'app/controllers/oauth/applications_controller.rb', line 13

def create
  @application = current_user.oauth_applications.new(application_params)
  if @application.save
    flash[:notice] = I18n.t(:notice, :scope => [:doorkeeper, :flash, :applications, :create])
    redirect_to oauth_applications_url(@application)
  else
    render :new
  end
end

#destroyObject


32
33
34
35
# File 'app/controllers/oauth/applications_controller.rb', line 32

def destroy
  flash[:notice] = I18n.t(:notice, scope: [:doorkeeper, :flash, :applications, :destroy]) if @application.destroy
  redirect_to oauth_applications_url
end

#indexObject


5
6
7
# File 'app/controllers/oauth/applications_controller.rb', line 5

def index
  @applications = current_user.oauth_applications
end

#newObject


9
10
11
# File 'app/controllers/oauth/applications_controller.rb', line 9

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

#updateObject


23
24
25
26
27
28
29
30
# File 'app/controllers/oauth/applications_controller.rb', line 23

def update
  if @application.update_attributes(application_params)
    flash[:notice] = I18n.t(:notice, scope: [:doorkeeper, :flash, :applications, :update])
    redirect_to oauth_application_url(@application)
  else
    render :edit
  end
end