How to set the default value of a best_in_place checkbox

42 Views Asked by At

I'm attempting to modify a Best In Place checkbox that looks like this

 best_in_place model, :attribute,
               url: model_path(model),
               as: :checkbox,
               collection: {:false=>"<i class='fa fa-square-o'></i>", :true=>"<i class='fa fa-check-square-o'></i>"}

We have some cases where we need the checkbox to default to "checked" and also to be disabled, but I can't find a way to do this. Does Best In Place support this and if so how can I make it happen?

1

There are 1 best solutions below

0
smathy On

A couple of things jump out immediately from the README:

:html_attrs: Hash of html arguments such as maxlength, default-value, etc. that will be set on the rendered input not the best_in_place span.

...and:

:value: Customize the starting value of the inline input (defaults to to the field's value)