# Base controller for the application # Provides common functionality and security configurations for all controllers class ApplicationController < ActionController::Base # Protect against Cross-Site Request Forgery (CSRF) attacks # Ensures that all non-GET requests include a valid authenticity token protect_from_forgery with: :exception # Restrict access to modern browsers only # Requires browsers to support modern web standards: # - WebP images for better compression # - Web Push notifications # - Badge API for notifications # - Import maps for JavaScript modules # - CSS nesting and :has() pseudo-class # allow_browser versions: :modern # allow_browser versions: { safari: 16.4, firefox: 121, ie: false } protected # Generate SEO-friendly path for an event def seo_event_path(event) year = event.start_time.year month = format("%02d", event.start_time.month) event_path(year: year, month: month, slug: event.slug) end helper_method :seo_event_path # Generate SEO-friendly booking URL for an event def seo_book_tickets_path(event) year = event.start_time.year month = format("%02d", event.start_time.month) book_event_tickets_path(year: year, month: month, slug: event.slug) end helper_method :seo_book_tickets_path # Generate SEO-friendly checkout URL for an event def seo_checkout_path(event) year = event.start_time.year month = format("%02d", event.start_time.month) event_checkout_path(year: year, month: month, slug: event.slug) end helper_method :seo_checkout_path # Generate SEO-friendly ticket URL def seo_ticket_path(ticket) ticket_path(event_slug: ticket.event.slug, ticket_id: ticket.id) end helper_method :seo_ticket_path # Generate SEO-friendly ticket view URL def seo_ticket_view_path(ticket) view_ticket_path(event_slug: ticket.event.slug, ticket_id: ticket.id) end helper_method :seo_ticket_view_path # Generate SEO-friendly ticket download URL def seo_ticket_download_path(ticket) download_ticket_path(event_slug: ticket.event.slug, ticket_id: ticket.id) end helper_method :seo_ticket_download_path end