17
<%= f.association :opportunity_status, :label => "Status", :input_html => {} %>
<%= f.select :source_type, options_for_select(["lead","vteam"],["lead"]) %>

On first line every thing is OK. On second line if I attach label the way I did in first line it show an error.

How can I specify label for select using simpleform?

1
  • 5
    Gotta accept some questions... Commented Mar 20, 2011 at 6:45

1 Answer 1

53

This is because f.select is not a simple_form method and does not support :label

This should work for you w/ simple form

<%= f.input :source_type, :label => "Lead or VTeam", :collection => ["lead","vteam"], :selected => "lead" %>

Hope this helps

3
  • This is the only place I've found an actual, non-model simple_form example. Sheesh!
    – Bob Walsh
    Commented May 6, 2013 at 19:15
  • @BobWalsh The Simple Form docs while having some holes definitely differentiates between Rails' default form_builders, eg. select, and simple form's builder input and the ability to mix using both of them. Custom-Inputs Commented Jun 19, 2013 at 16:04
  • Thank you, from the bottom of my heart...I have no idea why the simple form docs are so bad.
    – jake
    Commented Aug 1, 2017 at 16:13

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.