I need to save a certain parameter in the database. Let's say the payment type for an online order.
models/order.rb
PAYMENT_TYPES = [ "Check", "Credit card", "Purchase order" ]
validates :pay_type, inclusion: PAYMENT_TYPES
views/orders/_form.rb
f.select :pay_type, Order::PAYMENT_TYPES, prompt: 'Select a payment method'
Question1: What are the advantages and disadvantages of using simple array PAYMENT_TYPES = [ "Check", "Credit card", "Purchase order" ] versus an array with key/value pair PAYMENT_TYPES = [ ["Check", 1], ["Credit card", 2], ["Purchase order", 3] ]?
Question2: Which one should I use if I know that there can be any kind of changes in the future (including changing of names and combining of categories)? Does it matter if actually matter whether database value is a number or a text-string? What's the practical difference?
Question3: Should I use string like above or should I use :symbols? If :symbols are better, then how can I make the original string available for view? Something like PAYMENT_TYPES = [ [:check, "Check"]]? Can I use :symbols with number value and still have string text available? I am very confused.
[:check, "Check"].