There are a few things you can do:
f.select :size, options_for_select(@sizes_availiable), include_blank: "Select Size"
validates :size, presence: true
validates :size, numericality: true
validates :size, format: { with: /\d+/ }
However, you should always include checks so that attackers do not manipulate the form or send random things.
source
share