Class: Doorkeeper::ApplicationsController

Inherits:
ApplicationController show all
Defined in:
app/controllers/doorkeeper/applications_controller.rb

Instance Method Summary collapse

Methods included from Helpers::Controller

#authenticate_admin!, #authenticate_resource_owner!, #current_resource_owner, #get_error_response_from_exception, #handle_token_exception, included, #resource_owner_from_credentials, #server, #skip_authorization?

Instance Method Details

#createObject



15
16
17
18
19
20
21
22
23
24
# File 'app/controllers/doorkeeper/applications_controller.rb', line 15

def create
  @application = Application.new(application_params)
  if @application.save
    flash[:notice] = I18n.t(:notice, :scope => [:doorkeeper, :flash, :applications, :create])
    p @application
    respond_with [:oauth, @application]
  else
    render :new
  end
end

#destroyObject



44
45
46
47
48
# File 'app/controllers/doorkeeper/applications_controller.rb', line 44

def destroy
  @application = Application.find(params[:id])
  flash[:notice] = I18n.t(:notice, :scope => [:doorkeeper, :flash, :applications, :destroy]) if @application.delete
  redirect_to oauth_applications_url
end

#editObject



30
31
32
# File 'app/controllers/doorkeeper/applications_controller.rb', line 30

def edit
  @application = Application.find(params[:id])
end

#indexObject



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

def index
    @applications = Application.find_all
end

#newObject



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

def new
  @application = Application.new
end

#showObject



26
27
28
# File 'app/controllers/doorkeeper/applications_controller.rb', line 26

def show
  @application = Application.find(params[:id])
end

#updateObject



34
35
36
37
38
39
40
41
42
# File 'app/controllers/doorkeeper/applications_controller.rb', line 34

def update
  @application = Application.find(params[:id])
  if @application.update_attributes(application_params)
    flash[:notice] = I18n.t(:notice, :scope => [:doorkeeper, :flash, :applications, :update])
    respond_with [:oauth, @application]
  else
    render :edit
  end
end