ruby - Rails enumerize with dynamic options -
I have a model to control different app settings. The value_type of each setting is string, integer, bullion and enum, if one setting is defined as an antum, then there are several anonymous_points in it (only saved as a key, with values in the context of the settings in the database) these I want to use the gem to handle energy. I tried a lot but I can not set the enum option from the database.
Here's my code that how do I try to define different anonym options.
Enumerate: enum_values, in: - & gt; {EnumOption.where (functional_parameter_id: self.id) .map (& amp ;: value.to_sym)}
After this I try to call Setting.find ( 1) .enum_values
and I got zero
.
If I call on Setting.enum_values.values
to call all the available options, then just call me ["# & lt ; Proc: 0x007fd7e78e9218@/Users/path/to/app/app/models/setting.rb: 31 (lambda) & gt; "]
Is it possible to enum the option To set form?
I do not think you should enumerate the literal number in with a lambda Do this feature is not documented anywhere, and by keeping an eye, it seems that it is strictly to tell that you pass an array.
Comments
Post a Comment