Class: StatementsController

Inherits:
ArtfullyOseController show all
Defined in:
app/controllers/statements_controller.rb

Instance Method Summary collapse

Instance Method Details

#indexObject



3
4
5
6
7
8
9
10
11
12
13
14
15
# File 'app/controllers/statements_controller.rb', line 3

def index
  authorize! :view, Statement
  if params[:event_id].present?
    @event = Event.find(params[:event_id])
    authorize! :view, @event
    @shows = @event.shows
    @statement = nil
    render :show and return
  else
    @events = current_organization.events
    @events.each {|event| authorize! :view, event}
  end
end

#showObject



17
18
19
20
21
22
23
# File 'app/controllers/statements_controller.rb', line 17

def show
  @show = ::Show.includes(:event => :venue, :items => [:order, :discount, :product => :ticket_type, :pass => :pass_type]).find(params[:id])
  authorize! :view, @show
  @event = @show.event
  @shows = @event.shows.includes(:event => :venue)
  @statement = Statement.for_show(@show, @show.imported?)
end