Class: Opro::Oauth::ClientAppController
- Inherits:
-
OproController
- Object
- ApplicationController
- OproController
- Opro::Oauth::ClientAppController
- Defined in:
- app/controllers/opro/oauth/client_app_controller.rb
Instance Method Summary collapse
- #create ⇒ Object
- #edit ⇒ Object
-
#index ⇒ Object
Show all client applications belonging to the current user.
- #new ⇒ Object
- #show ⇒ Object
- #update ⇒ Object
Instance Method Details
#create ⇒ Object
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 |
#edit ⇒ Object
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 |
#index ⇒ Object
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 |
#new ⇒ Object
4 5 6 |
# File 'app/controllers/opro/oauth/client_app_controller.rb', line 4 def new @client_app = Opro::Oauth::ClientApp.new end |
#show ⇒ Object
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 |
#update ⇒ Object
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 |