ruby-on-railsrubyrubygemsbest-in-place

Display checkbox best_in_place ruby gem


I am using the best_in_place gem in a project, and i am trying to display a checkbox on it's own place, but i cannot do it. I am searching about it, but i cannot find out the answer anywhere. I just can find people talking about display either "no" or "yes"... Or anything else. But i just want to see the checkbox checked or not.


Solution

  • I am using font-awesome but you can use it also with bootstrap or other images. My solution for displaying checkboxes were simply using the raw method to render a checkbox image (in my case one of the font-awesome icons)

    = best_in_place @project, 
        :active, 
        :type => :checkbox, 
        :collection => {false: raw("<i class='icon-check-empty'></i>"), true: raw("<i class='icon-check'></i>")}
    

    And now it looks like the following:

    best_in_place with checkboxes