Year: 2015

Validate a checkbox in Rails

If you have to validate a checkbox in your frontend that is part of your model (e.g. acceptregulation) the following snippet works like charm.

 

Display html in Rails form from l18n/translations

To display html without html encoding you have to use the .html_safe method for the translation:

en.yml

index.html.erb

 

Rails translating booleans in I18n files

While I was working on a multilingual project I came across a label issue for booleans. In my application the field approved is boolean field and displays by default true or false. I want it to display yes or no; and ja and nein in German. more