Hi I have the following dropdown form where I want to preselect dropdown value depending on whether a user is an admin or not.
However the u.admin seems not doing the job. Is there a way I can achieve this with option_for_select?
<%= form_tag users_path(u), method: :patch do %>
<%= select_tag :admin, options_for_select([['Admin user', true], ['Normal user', nil]], u.admin) %>
<%= submit_tag 'Update', class: "btn btn-sm btn-primary" %>
<% end %>
below is my usermodel
create_table "users", force: :cascade do |t|
t.string "email", default: "", null: false
t.string "encrypted_password", default: "", null: false
t.string "avatar"
t.string "lastname"
t.string "firstname"
t.string "description"
t.boolean "admin"
t.index ["email"], name: "index_users_on_email", unique: true
t.index ["reset_password_token"], name: "index_users_on_reset_password_token", unique: true
end