Reputation: 751
In Rails 5, the enum value type can only accept symbols, i.e. immutable "strings" with letters and digits.
How would you best use enum values in Rails, which have to be shown also with their special characters like e.g. 'Hip-Hop/Rap'
included in the enum field genre
?
Upvotes: 1
Views: 1024
Reputation: 36860
you can use quotes around symbol text if it contains special characters.
[:classical, :pop, :'Hip-Hop/Rap']
Upvotes: 4