Sha256: d67bf2cf4424cc17a8c60915fbf957b2f6b9d071132bbe39fbcbb3cf73fc5fd2

Contents?: true

Size: 1.18 KB

Versions: 3

Compression:

Stored size: 1.18 KB

Contents

class ApplicationsController < ApplicationController

  before_filter :ensure_admin
  layout :admin_layout

  def index
    @applications = OauthProviderEngine::Application.all
  end

  def show
    @application = OauthProviderEngine::Application.find(params[:id])
  end

  def new
    @application = OauthProviderEngine::Application.new(params[:oauth_provider_engine_application])
  end

  def create
    @application = OauthProviderEngine::Application.new(params[:oauth_provider_engine_application])
    if @application.save
      redirect_to oauth_provider_engine_applications_path
    else
      render :new
    end
  end

  def edit
    @application = OauthProviderEngine::Application.find(params[:id])
  end

  def update
    @application = OauthProviderEngine::Application.find(params[:id])
    if @application.update_attributes(params[:oauth_provider_engine_application])
      redirect_to @application
    else
      render :edit
    end
  end

  def destroy
    @application = OauthProviderEngine::Application.find(params[:id])
  end

  protected

  def ensure_admin
    OauthProviderEngine.admin_authenticate_method.call(self)
  end

  def admin_layout
    OauthProviderEngine.admin_layout
  end

end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
oauth_provider_engine-0.0.5 app/controllers/applications_controller.rb
oauth_provider_engine-0.0.4 app/controllers/applications_controller.rb
oauth_provider_engine-0.0.3 app/controllers/applications_controller.rb