Class: Doorkeeper::ApplicationsController
- Inherits:
-
ApplicationController
- Object
- ApplicationController
- Doorkeeper::ApplicationsController
- Defined in:
- app/controllers/doorkeeper/applications_controller.rb
Instance Method Summary collapse
- #create ⇒ Object
- #destroy ⇒ Object
- #edit ⇒ Object
- #index ⇒ Object
- #new ⇒ Object
- #show ⇒ Object
- #update ⇒ Object
Instance Method Details
#create ⇒ Object
31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 |
# File 'app/controllers/doorkeeper/applications_controller.rb', line 31 def create @application = Doorkeeper.config.application_model.new(application_params) if @application.save respond_to do |format| format.html do flash[:notice] = I18n.t(:notice, scope: %i[doorkeeper flash applications create]) flash[:application_secret] = @application.plaintext_secret redirect_to oauth_application_url(@application) end format.json { render json: @application, as_owner: true } end else respond_to do |format| format.html { render :new } format.json do errors = @application.errors. render json: { errors: errors }, status: :unprocessable_entity end end end end |
#destroy ⇒ Object
80 81 82 83 84 85 86 87 88 89 90 91 |
# File 'app/controllers/doorkeeper/applications_controller.rb', line 80 def destroy destroyed = @application.destroy respond_to do |format| format.html do flash[:notice] = I18n.t(:notice, scope: i18n_scope(:destroy)) if destroyed redirect_to oauth_applications_url end format.json { head :no_content } end end |
#edit ⇒ Object
56 |
# File 'app/controllers/doorkeeper/applications_controller.rb', line 56 def edit; end |
#index ⇒ Object
11 12 13 14 15 16 17 18 |
# File 'app/controllers/doorkeeper/applications_controller.rb', line 11 def index @applications = Doorkeeper.config.application_model.ordered_by(:created_at) respond_to do |format| format.html format.json { head :no_content } end end |
#new ⇒ Object
27 28 29 |
# File 'app/controllers/doorkeeper/applications_controller.rb', line 27 def new @application = Doorkeeper.config.application_model.new end |
#show ⇒ Object
20 21 22 23 24 25 |
# File 'app/controllers/doorkeeper/applications_controller.rb', line 20 def show respond_to do |format| format.html format.json { render json: @application, as_owner: true } end end |
#update ⇒ Object
58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 |
# File 'app/controllers/doorkeeper/applications_controller.rb', line 58 def update if @application.update(application_params) respond_to do |format| format.html do flash[:notice] = I18n.t(:notice, scope: i18n_scope(:update)) redirect_to oauth_application_url(@application) end format.json { render json: @application, as_owner: true } end else respond_to do |format| format.html { render :edit } format.json do errors = @application.errors. render json: { errors: errors }, status: :unprocessable_entity end end end end |