Class: HappeningsController
- Inherits:
-
ApplicationController
- Object
- ActionController::Base
- ApplicationController
- HappeningsController
- Defined in:
- app/controllers/happenings_controller.rb
Overview
Instance Method Summary collapse
-
#filter_params ⇒ Object
private
filter params for search Happening.
-
#index ⇒ Object
GET /event/:event_id/happenings show a paginate list of Happening.
-
#show ⇒ Object
GET /event/:event_id/happenings/:id Show detail of happening and a form to prenotate a ticket.
Methods inherited from ApplicationController
#access_denied!, #default_url_options, #record_not_found!, #set_turbo, #switch_locale
Instance Method Details
#filter_params ⇒ Object (private)
filter params for search Happening
28 29 30 |
# File 'app/controllers/happenings_controller.rb', line 28 def filter_params params.fetch(:filter, {}).permit(:category, :from, :scope, :text, :to) end |
#index ⇒ Object
GET /event/:event_id/happenings show a paginate list of Happening
7 8 9 10 11 12 13 14 15 16 |
# 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] @pagy, @happenings = pagy(Happening.searchable(from:, to:, event_id:, group_id:, text:), items: 6) end |
#show ⇒ Object
GET /event/:event_id/happenings/:id Show detail of happening and a form to prenotate a ticket
20 21 22 23 |
# File 'app/controllers/happenings_controller.rb', line 20 def show @happening = Happening.includes(:event).find(params[:id]) @event = @happening.event end |