Question

Say I have an ActiveResource which has an schema with several attributes. One of the attributes is expected to have three values (defined by the API where the ActiveResource is talking to).

Since I am creating forms for this ActiveResource object, I want to know where should I store those three possible values? Imagine that in the form I want to show a drop down list.

Was it helpful?

Solution

This answer in the Stackoverflow post has an ActiveRecord example for storing possible values in a separate class and then validating that an ActiveRecord attribute has one of those values: Enumeration in Ruby on rails

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top