Skip to content

Commit 2dff7ed

Browse files
author
Hannes Fostie
committed
Adds enum_select custom values documentation to the readme file.
1 parent 1375e19 commit 2dff7ed

1 file changed

Lines changed: 15 additions & 0 deletions

File tree

README.txt

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,3 +58,18 @@ In views:
5858
<%= f.enum_select :severity %>
5959
<% end %>
6060

61+
It is also possible to pass in custom values for the attributes using a hash:
62+
63+
<%= enum_select(@enumeration, 'severity', {:low => 'Low severity', :medium => 'Medium severity'}) %>
64+
65+
Note: It is not required to supply all limit options. If one is missing, the limit will be displayed instead.
66+
67+
As an added bonus, this sets you right up for use with I18n like so:
68+
69+
<%= enum_select(@enumeration, 'severity', I18n.t('severity')) %>
70+
71+
And in your locale file:
72+
73+
severity:
74+
low: Low severity
75+
medium: Medium severity

0 commit comments

Comments
 (0)