I need to check radio button in active admin form
I’ve a User model and in that I’ve a attribute for user’s role. and for
the
list of roles I’ve created a enum.
In my model :
enum role: [:corporate, :demo, :free]
my new or edit form :
form do |f|
f.inputs “Users” do
f.input :email
f.input :password
f.input :role, as: :radio, collection: User.roles.except(:free)
end
f.actions
end
when I create a new user and select a role and save, then I can save the
role with the user. but when I come to edit page i didn’t see the
related
role radio button as checked.
I need to do the two things
- on new page show first radio button as checked
- on edit page checked the radio button of user’s role
May be this very silly question, but I don’t know how to do it and
didn’t
find any solution.
Please help and Thanks in advance!