Fork me on GitHub

Zeke Sikelianos

Mumblings from the code swamp. Find my more interesting online-ness at zeke.sikelianos.com.

Human-friendly model attribute labels with i18n and Formtastic

I’ve been using the awesome Formtastic FormBuilder DSL in all my Rails projects for a while now. It’s semantic nature makes it a great tool for generating HTML forms that are consistent and easy to style.

Today I discovered a new feature: you can define custom labels/names for your model attributes by adding a snippet like the one below to your project’s en.yml (or other internationalization file). Formtastic’s form.input helper will automatically use the values you specify there for your form’s labels.


Page 1 of 1