Question

I have enumerize field in my model. And Rails admin automatically create for this field dropdown input. Does it possible to create radio input instead dropdown ?

Was it helpful?

Solution

You can use partial to render that field. in rails_admin.rb inside model config:

field :<your_field> do
  partial "<your_field_partial>"  #app/views/rails_admin/main/<your_field_partial>  
                                  #You can use sub directory there as expected.
end

The partial: I am posting an example>>>

<%= form.hidden_field field.method_name %>
<% permission_array = @object.permissions.split(',') %>
<% Constant::ROLES.each do |role| %>
  <p class="permission_roles">
    <%= check_box_tag role, role, permission_array.include?(role) %> <span><%= role.humanize %></span>
  </p>
<% end %>
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top