I'm working on an RoR project with the Simple_Form gem. For those who don't know, simple form creates easier form helpers for use in views. My question is regarding the f.association
helper which allows users to easily select associations on models via a select box, radio buttons or checkboxes.
f.association
has an option called value_method
which allows you to pass a method for generating the name of the individual models in the association to choose from. The default is just to_s
, so it will work with select boxes. However, I'm using radio buttons, and I'd like to know if anyone knows of a way to use the render partial method as the value_method
.
In my setup, I have a User model with a user.haml partial that I'd like to be rendered next to each checkbox, that way users selecting other users can have any easy to recognize user div with picture, name, and last login to choose.