Sha256: 9d699c6bbde2ce402284e0736e909e39f84f94aaf1a0e677de5c14337cbe984a

Contents?: true

Size: 906 Bytes

Versions: 1

Compression:

Stored size: 906 Bytes

Contents

require_dependency "skydrive/application_controller"

module Skydrive
  class EmberController < ApplicationController
    def index
    end

    def new_authentication
      @account = Account.new
      render layout: false
    end

    def generate_authentication
      @account = Account.new(account_params)
      @account.key = SecureRandom.uuid
      @account.secret = SecureRandom.hex
      if !@account.save
        render 'new_authentication', layout: false
      end
      render layout: false
    end

    def health_check
      if database_healthy?
        head 200
      else
        head 500
      end
    end

    private

    def database_healthy?
      ActiveRecord::Base.connection
      true
    rescue ActiveRecord::NoDatabaseError, PG::ConnectionBad
      false
    end

    def account_params
      params.require(:account).permit(:name, :email, :institution, :title)
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
lti_skydrive-1.2.2 app/controllers/skydrive/ember_controller.rb