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