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
enums ruby-on-rails-4 has-many


source to share


No one has answered this question yet

See similar questions:

1
Moving static data from db to code in rails 3

or similar:

3575
How to list a transfer?
2964
How to cast int to enum?
1954
What is the preferred syntax for defining enums in JavaScript?
1818
How to get enum value from string value in Java?
1658
Get int value from enum in c #
1555
Java enum member comparison: == or equals ()?
1204
What does the Enlue [Flags] Enum attribute mean in C #?
1146
How can I represent "Enum" in Python?
1077
What is a typedef enum in Objective-C?
1012
Can you view all the enumeration values?



All Articles
Loading...
X
Show
Funny
Dev
Pics