Class: Opro::Oauth::ClientAppController

Inherits:
OproController
  • Object
show all
Defined in:
app/controllers/opro/oauth/client_app_controller.rb

Instance Method Summary collapse

Instance Method Details

#createObject



32
33
34
35
36
37
38
39
40
# File 'app/controllers/opro/oauth/client_app_controller.rb', line 32

def create
  @client_app = Opro::Oauth::ClientApp.find_by_user_id_and_name(current_user.id, params[:opro_oauth_client_app][:name])
  @client_app ||= Opro::Oauth::ClientApp.create_with_user_and_name(current_user, params[:opro_oauth_client_app][:name])
  if @client_app.save
    redirect_to oauth_client_app_path(@client_app)
  else
    render :new
  end
end

#editObject



17
18
19
# File 'app/controllers/opro/oauth/client_app_controller.rb', line 17

def edit
  @client_app = Opro::Oauth::ClientApp.where(id: params[:id], user_id: current_user.id).first
end

#indexObject

Show all client applications belonging to the current user



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

def index
  @client_apps = Opro::Oauth::ClientApp.where(user_id: current_user.id)
end

#newObject



4
5
6
# File 'app/controllers/opro/oauth/client_app_controller.rb', line 4

def new
  @client_app = Opro::Oauth::ClientApp.new
end

#showObject



13
14
15
# File 'app/controllers/opro/oauth/client_app_controller.rb', line 13

def show
  @client_app = Opro::Oauth::ClientApp.where(id: params[:id], user_id: current_user.id).first
end

#updateObject



21
22
23
24
25
26
27
28
29
# File 'app/controllers/opro/oauth/client_app_controller.rb', line 21

def update
  @client_app = Opro::Oauth::ClientApp.where(id: params[:id], user_id: current_user.id).first
  @client_app.name = params[:opro_oauth_client_app][:name]
  if @client_app.save
    redirect_to oauth_client_app_path(@client_app)
  else
    render :edit
  end
end