fix: Correct ticket creation flow and home page availability check

- Fix incorrect route helper in tickets controller (order_checkout_path -> checkout_order_path)
- Add missing set_event before_action for create action
- Fix home page availability check to use ticket_types.available_quantity instead of tickets.quantity
- Update AGENT.md with ast-grep documentation for development tools

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
kbe
2025-09-02 22:43:14 +02:00
parent ca81d2360c
commit 0ba6634e99
3 changed files with 36 additions and 3 deletions

View File

@@ -4,7 +4,7 @@
# complete their details and proceed to payment
class TicketsController < ApplicationController
before_action :authenticate_user!, only: [ :new, :payment_success, :payment_cancel ]
before_action :set_event, only: [ :new ]
before_action :set_event, only: [ :new, :create ]
# Handle new ticket creation
#
@@ -87,7 +87,7 @@ class TicketsController < ApplicationController
if success
session[:draft_order_id] = @order.id
session.delete(:pending_cart)
redirect_to order_checkout_path(@order)
redirect_to checkout_order_path(@order)
else
redirect_to ticket_new_path(@event.slug, @event.id)
end

View File

@@ -36,7 +36,7 @@
<% if event.featured? %>
<span class="badge badge-featured">★ En vedette</span>
<% end %>
<% if event.tickets.any? { |ticket| ticket.quantity > 0 } %>
<% if event.ticket_types.any? { |ticket_type| ticket_type.available_quantity > 0 } %>
<span class="badge badge-available">Disponible</span>
<% end %>
</div>