30 lines
707 B
Ruby
Executable File
30 lines
707 B
Ruby
Executable File
# Events controller
|
|
#
|
|
# This controller manages all events. It load events for homepage
|
|
# and display for pagination.
|
|
class EventsController < ApplicationController
|
|
before_action :authenticate_user!, only: []
|
|
before_action :set_event, only: [ :show ]
|
|
|
|
# Display all events
|
|
def index
|
|
@events = Event.includes(:user).upcoming.page(params[:page]).per(12)
|
|
end
|
|
|
|
# Display desired event
|
|
#
|
|
# Find requested event and display it to the user
|
|
def show
|
|
# Event is set by set_event callback
|
|
end
|
|
|
|
private
|
|
|
|
# Set the current event in the controller
|
|
#
|
|
# Expose the current @event property to method
|
|
def set_event
|
|
@event = Event.includes(:ticket_types).find(params[:id])
|
|
end
|
|
end
|