- Create new TicketsController with actions for name collection, creation, and checkout - Add dedicated ticket views (new.html.erb, checkout.html.erb, show.html.erb) - Update ticket_selection_controller.js to handle form submission via AJAX - Add store_cart endpoint in EventsController for session-based cart management - Update routes to support new ticket flow: /tickets/new, /create, /checkout - Fix attribute name consistency across views (title→name, starts_at→start_time) - Add Stripe checkout integration with proper error handling - Remove deprecated collect_names flow in favor of streamlined approach The flow is now: Event selection → AJAX cart storage → Name collection → Checkout → Payment
27 lines
848 B
Ruby
Executable File
27 lines
848 B
Ruby
Executable File
class CreateTickets < ActiveRecord::Migration[8.0]
|
|
def change
|
|
create_table :tickets do |t|
|
|
t.string :qr_code
|
|
t.integer :price_cents
|
|
t.string :status, default: "draft"
|
|
|
|
# Add names to ticket
|
|
t.string :first_name
|
|
t.string :last_name
|
|
|
|
t.references :user, null: true, foreign_key: false
|
|
t.references :ticket_type, null: false, foreign_key: false
|
|
|
|
t.timestamps
|
|
end
|
|
|
|
add_index :tickets, :qr_code, unique: true
|
|
add_index :tickets, :user_id unless index_exists?(:tickets, :user_id)
|
|
add_index :tickets, :ticket_type_id unless index_exists?(:tickets, :ticket_type_id)
|
|
|
|
# Add indexes for better performance
|
|
# add_index :tickets, :first_name unless index_exists?(:tickets, :first_name)
|
|
# add_index :tickets, :last_name unless index_exists?(:tickets, :last_name)
|
|
end
|
|
end
|