Repository navigation
Fix README description of User.status.values - #387
Conversation
It doesn't return "I18n text values" but just "values"
|
I can confirm this, as I stumbled across this today too |
|
The wrong description was apparently introduced 6 months ago during a README reorganization: 4c6a4a8#diff-b335630551682c19a781afebcf4d07bf978fb1f8ac04c6bf87428ed5106870f5L158-L163 |
|
Thanks! |
|
Thank you! I didn't know it returned Here is a small refactoring of this section, including I'll let you decide if you like it better. I18n Helper Methods*_text / .textAttribute's I18n text value: @user.status_text # or @user.status.textvaluesList of possible values for an enumerized attribute: User.status.values # or User.enumerized_attributes[:status].values
# => ['student', 'employed', 'retired']I18n text valuesList of possible I18n text values for an enumerized attribute: User.status.values.collect(&:text)
# => ['Student', 'Employed', 'Retiree']Form exampleUse it with forms (it supports <%= form_for @user do |f| %>
<%= f.select :status, User.status.options %>
<% end %> |
|
@MichaelHoste looks good! Please send a Pr with that 🙇 |
Follow-up of brainspec#387
|
Done #388 Thank you for this! I'm sure it will help some people. |
User.status.valuesdoesn't seem to return "I18n text values" as mentioned in the README, but just "values".with:
User.status.valueswill return["student", "employed", "retired"]and not["Student", "Employed", "Retiree"].Or maybe am I missing something?