Sha256: e3f1d46ab8e762f6291278945d2219c3c9c32a7c15fcfc6725c0bd4f876e33eb

Contents?: true

Size: 1.06 KB

Versions: 11

Compression:

Stored size: 1.06 KB

Contents

class Mobile::ShowsController < ApplicationController
  rescue_from ActiveRecord::RecordNotFound do |e|
    case e.message
    when /Organization/
      error = {
        :error => "Could not load shows",
        :reason => "Organization could not be found",
        :code => 2
      }
      render :json => error, :status => 404
    when /Event/
      error = {
        :error => "Could not load shows",
        :reason => "Event could not be found",
        :code => 3
      }
      render :json => error, :status => 404
    end
  end

  def show
    organization = current_user.organizations.find(params[:organization_id])
    show = organization.shows.find(params[:id])
    render :json => show, :serializer => ShowSerializer
  end

  def index
    organization = current_user.organizations.find(params[:organization_id])
    event = organization.events.find(params[:event_id])
    shows = event.shows

    if params[:now]
      around = Time.parse(params[:now])
      shows = shows.where("datetime > ?", around - 12.hours)
    end

    render :json => shows, :event => false
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
artfully_ose-1.3.0.pre4 app/controllers/mobile/shows_controller.rb
artfully_ose-1.3.0.pre3 app/controllers/mobile/shows_controller.rb
artfully_ose-1.3.0.pre2 app/controllers/mobile/shows_controller.rb
artfully_ose-1.3.0.pre1 app/controllers/mobile/shows_controller.rb
artfully_ose-1.2.0 app/controllers/mobile/shows_controller.rb
artfully_ose-1.2.0.beta.1 app/controllers/mobile/shows_controller.rb
artfully_ose-1.2.0.alpha.2 app/controllers/mobile/shows_controller.rb
artfully_ose-1.2.0.alpha.1 app/controllers/mobile/shows_controller.rb
artfully_ose-1.2.0.pre.27 app/controllers/mobile/shows_controller.rb
artfully_ose-1.2.0.pre.26 app/controllers/mobile/shows_controller.rb
artfully_ose-1.2.0.pre.24 app/controllers/mobile/shows_controller.rb