Rails 4.1 enum and has_many

Is there a way to associate multiple enum values ​​with a model in Rails 4.1 enum, or do I need to do this using bit masking ( http://railscasts.com/episodes/189-embedded-association?view=asciicast )? I have a property that I want to keep static (I started by saying it had a different model, but due to the legacy application, the IDs need to be static and immutable), but they should be able to bind somewhat to the model.

To be clear: using an enumeration in Rails 4.1 is very simple (find any example of an ActiveRecord enum like a state machine). I'm looking for a model to have many enums - that is, like many other models (e.g. Product has_many DeviceLocations or Vehicle has_many Tires). I would like has_many to be from a static enum and not from an editable / deleteable model.

+3


source to share





All Articles