I have a fairly simple data model that I wish to include an enumerated value in. If I set the :default
value of that field, it has that value when the model is instantiated. If I explicitly assign a symbol from among my list of defined values to that field, it becomes an ordinary Symbol with no enumeration magic. If I do not assign a default value in the model definition, then the value is nil
and cannot be modified.
Attached files:
- 01-output.txt - snippet of output from running the spec
- 02-article.rb - the data model with the enumerated field (
article_status
) - 03-article_spec.rb - (part of) an RSpec specfile for
article.rb