0
I own a select in my form:
<%= form.select :status, options_for_select([ ["Ativo", 0], ["Inativo", 1] ]), {include_blank: "Selecione ..."}, class: "form-control", required: true %>
To include a new record, my code works, only when I click the button to change the product, my select, does not receive the value of the database.
Example: Certain product, is with the value = 1, so when I click the change, it should be with the value = "Inactive".
It worked, thank you very much!
– Nícolas Braz
What would it be like to use "Enum" for my column?
– Nícolas Braz
reading the question again, I figured out why I wasn’t magically picking up from the model. You can take the
options_for_select
and direct the status array. Thisoptions_for_select
is not part of the objectform
, so I guess it didn’t pick up automatically. Can you validate? Could it be that you’re not even in doc from Rails– manuwell