disable select dropdown for association?

30 views
Skip to first unread message

Matthew Newton

unread,
Apr 26, 2017, 10:49:33 AM4/26/17
to SimpleForm
I want to display an association input as a string rather than the default select dropdown.  My code (I'm using HAML) looks like:

= simple_form_for my_model do |f|
 
= f.association :associated_model, label: 'Associated Model Label', label_method: :my_label_method


When I use as: :string, and label_method: :my_label_method, it displays the id of the associated model rather than my_label_method.  When I don't use as: :string, it displays the correct output of :my_label_method, but as a select dropdown rather than as a string.  I also tried input_html: { multiple: false } with no luck.  Is there a way to get it to display the string value of :my_label_method without the select dropdown?   Thanks!
Reply all
Reply to author
Forward
0 new messages