Asterisk for "required" on the right for simple_form

Using simple_form, you can put the 'required' mark (by default, an asterisk) on the right of the label, instead of the left as it normally appears, by editing the config/initializers/simple_form.rb file and adding this:

config.label_text = lambda { |label, required| "#{label} #{required}" }

:)


3 comments:

  1. Hilarious! I googled this and found your post. I totally missed that line – thanks!

    ReplyDelete
  2. Really great post. This answered the majority of my questions. When I read this I actually opened up a word document and started taking notes haha.
    mediaonlines.com

    ReplyDelete