zmbacker/enum_help

"No" shown as "false"

micred opened this issue · 1 comments

When I have an enum option that is translated as "No", simple_form shows "false".
Am I wrong?

PS: workaround is adding a space after "No":

enums:
  user:
    product_already_have_km:
      already_customer: 'Sì'
      new_customerr: 'No '
knu commented

'No' should work. A bare word No means false in YAML; I guess it was the case for you.

      new_customerr: No #=> false
      new_customerr: 'No' #=> "No"
      new_customerr: "No" #=> "No"

You should also be careful if you use "yes" or "no" as a key.

      yes: '' # Bad; the key is treated as `true`.
      'yes': '' # Good