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
30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 |
# File 'app/controllers/doorkeeper/applications_controller.rb', line 30 def create @application = Doorkeeper.config.application_model.new(application_params) if @application.save flash[:notice] = I18n.t(:notice, scope: %i[doorkeeper flash applications create]) flash[:application_secret] = @application.plaintext_secret respond_to do |format| format.html { redirect_to oauth_application_url(@application) } 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
75 76 77 78 79 80 81 82 |
# File 'app/controllers/doorkeeper/applications_controller.rb', line 75 def destroy flash[:notice] = I18n.t(:notice, scope: i18n_scope(:destroy)) if @application.destroy respond_to do |format| format.html { redirect_to oauth_applications_url } format.json { head :no_content } end end |
#edit ⇒ Object
53 |
# File 'app/controllers/doorkeeper/applications_controller.rb', line 53 def edit; end |
#index ⇒ Object
10 11 12 13 14 15 16 17 |
# File 'app/controllers/doorkeeper/applications_controller.rb', line 10 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
26 27 28 |
# File 'app/controllers/doorkeeper/applications_controller.rb', line 26 def new @application = Doorkeeper.config.application_model.new end |
#show ⇒ Object
19 20 21 22 23 24 |
# File 'app/controllers/doorkeeper/applications_controller.rb', line 19 def show respond_to do |format| format.html format.json { render json: @application, as_owner: true } end end |
#update ⇒ Object
55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 |
# File 'app/controllers/doorkeeper/applications_controller.rb', line 55 def update if @application.update(application_params) flash[:notice] = I18n.t(:notice, scope: i18n_scope(:update)) respond_to do |format| format.html { redirect_to oauth_application_url(@application) } 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 |