diff options
| author | Xinhui | 2017-10-06 12:03:24 +0200 |
|---|---|---|
| committer | Xinhui | 2017-10-06 12:03:24 +0200 |
| commit | dbbd6869db784136c0a9017b6754a44ccacc719b (patch) | |
| tree | 779e3c5fe4bed9cc89553c9320fb3bfb00685b9f /lib | |
| parent | 5005fd84579355bfb490203926f68275c21a92af (diff) | |
| download | chouette-core-dbbd6869db784136c0a9017b6754a44ccacc719b.tar.bz2 | |
ComplianceControl#new target field
Refs #4687
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/model_attribute.rb | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/lib/model_attribute.rb b/lib/model_attribute.rb index 4d246853a..33f6c80aa 100644 --- a/lib/model_attribute.rb +++ b/lib/model_attribute.rb @@ -5,6 +5,20 @@ class ModelAttribute @__all__ ||= [] end + def self.grouped_options(type) + {}.tap do |el| + group_by_class.each do |key, values| + values.reject!{ |x| x.data_type != type } + el[I18n.t("activerecord.models.#{key}.one")] = values.map do |i| + [ + I18n.t("activerecord.attributes.#{i.klass}.#{i.name}"), + "#{i.klass}.#{i.name}" + ] + end + end + end + end + def self.define(klass, name, data_type) all << new(klass, name, data_type) end |
