I have model,
class Test < ActiveRecord::Base
as_enum :test, [:test, :test_1, :test_1_2]
end
I need to create a f.select dropdown with enum. But I am facing an issue preparing dropdown with enum.
Here is my code:
<%= f.select :test, options_for_select(Test.tests.keys.to_a), {}, :class => "form-control" %>
But prepared a wrong select box.
Can anyone have any suggestion?
Aucun commentaire:
Enregistrer un commentaire