rails_admin change boolean default icon true and false instead string 'true' and 'false'

1.1k Views Asked by At

enter image description here

I did created on one model with boolean field

rails g model saas reserved_seat:boolean

when i add new record it will show only ✓ , ✘ and ‒

enter image description here

Instead i need to value display neither 'true' or 'false' nor 'ON' or 'OFF' in string

2

There are 2 best solutions below

0
On BEST ANSWER

What I did was:

field :reserved_seat do
   pretty_value do
    if bindings[:object].reserved_seat==true
        %{<span style="color:blank;" >ON</span>}.html_safe
      else
        %{<span style="color:blank;" >OFF</span>}.html_safe
    end
  end
 end   
1
On

Refer the documentation here wiki

RailsAdmin.config do |config|
  config.model 'Saas' do
    edit do
      field :reserved_seat, :string
    end
  end
end