Class: HappeningsController

Inherits:
ApplicationController show all
Defined in:
app/controllers/happenings_controller.rb

Overview

this controller manage the User views for Happening model.

Instance Method Summary collapse

Methods inherited from ApplicationController

#default_url_options, #new_session_path

Instance Method Details

#indexObject

GET /event/:event_id/happenings show a paginate list of Happening



7
8
9
10
11
12
13
14
15
16
17
# File 'app/controllers/happenings_controller.rb', line 7

def index
  @categories = Group.pluck :title, :id
  @scope   = filter_params[:scope]
  from     = filter_params[:from]
  to       = filter_params[:to]
  event_id = filter_params[:scope]
  group_id = filter_params[:category]
  text     = filter_params[:text]
  soldout  = filter_params[:soldout]
  @pagy, @happenings = pagy(Happening.searchable(from:, to:, event_id:, group_id:, text:, soldout:, reserved: include_reserved?), items: 6)
end

#showObject

GET /event/:event_id/happenings/:id Show detail of happening and a form to prenotate a ticket



21
22
23
24
25
# File 'app/controllers/happenings_controller.rb', line 21

def show
  @happening = Happening.includes(:event).find(params[:id])
  @event = @happening.event
  access_denied! if @event.reserved? && !include_reserved?
end