Sha256: 9acf81ff4c8063c3cc20c2175841d756f5dc9ddce0c62f45d53e5809280021a4

Contents?: true

Size: 803 Bytes

Versions: 16

Compression:

Stored size: 803 Bytes

Contents

class QueryVersionsController < ApplicationController
  respond_to :html, :json

  before_filter :retrieve_query_version, only: :show
  authorize_resource only: [:show]

  def index
    respond_to do |format|
      format.json do
        @query_versions = query_versions.accessible_by(current_ability)
        render json: @query_versions
      end
    end
  end

  def show
    respond_to do |format|
      format.html { render :index }
      format.json do
        render json: @query_version
      end
    end
  end

  private

  def retrieve_query_version
    @query_version ||= if params[:id] == 'latest'
      query_versions.first
    else
      QueryVersion.find(params[:id])
    end
  end

  def query_versions
    QueryVersion.where(query_id: params[:query_id]).order('version DESC')
  end
end

Version data entries

16 entries across 16 versions & 1 rubygems

Version Path
aleph_analytics-0.4.9.pre.dev app/controllers/query_versions_controller.rb
aleph_analytics-0.4.8 app/controllers/query_versions_controller.rb
aleph_analytics-0.4.7 app/controllers/query_versions_controller.rb
aleph_analytics-0.4.4 app/controllers/query_versions_controller.rb
aleph_analytics-0.4.2 app/controllers/query_versions_controller.rb
aleph_analytics-0.4.1 app/controllers/query_versions_controller.rb
aleph_analytics-0.3.0 app/controllers/query_versions_controller.rb
aleph_analytics-0.2.0 app/controllers/query_versions_controller.rb
aleph_analytics-0.1.0 app/controllers/query_versions_controller.rb
aleph_analytics-0.0.6 app/controllers/query_versions_controller.rb
aleph_analytics-0.0.5 app/controllers/query_versions_controller.rb
aleph_analytics-0.0.4 app/controllers/query_versions_controller.rb
aleph_analytics-0.0.3 app/controllers/query_versions_controller.rb
aleph_analytics-0.0.2 app/controllers/query_versions_controller.rb
aleph_analytics-0.0.1.alpha app/controllers/query_versions_controller.rb
aleph_analytics-0.0.0.alpha app/controllers/query_versions_controller.rb