From c06bfd7b930e6d3795d67c95e86960cbd0aad1e2 Mon Sep 17 00:00:00 2001 From: Owen Hu Date: Mon, 8 Apr 2024 11:01:11 -0700 Subject: [PATCH] validate currency --- app/models/ticket_purchase.rb | 2 +- app/views/tickets/index.html.haml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/models/ticket_purchase.rb b/app/models/ticket_purchase.rb index 28c87678e..ff07ea4ef 100644 --- a/app/models/ticket_purchase.rb +++ b/app/models/ticket_purchase.rb @@ -23,7 +23,7 @@ class TicketPurchase < ApplicationRecord belongs_to :conference belongs_to :payment - validates :ticket_id, :user_id, :conference_id, :quantity, presence: true + validates :ticket_id, :user_id, :conference_id, :quantity, :currency, presence: true validate :one_registration_ticket_per_user validate :registration_ticket_already_purchased, on: :create validates :quantity, numericality: { greater_than: 0 } diff --git a/app/views/tickets/index.html.haml b/app/views/tickets/index.html.haml index 8470327f5..ac50a4d6c 100644 --- a/app/views/tickets/index.html.haml +++ b/app/views/tickets/index.html.haml @@ -15,7 +15,7 @@ %strong = @conference.title .col-md-4.text-right - - if ENV['SHOW_CURRENCY_SELECTOR'] == 'true' + - if true .form-group %label{for: 'currency_selector'} Currency: = select_tag :currency, options_for_select(@currencies), id: 'currency_selector', class: 'form-control', style: 'width: auto; display: inline-block;'