diff options
| author | Teddy Wing | 2017-09-19 15:20:01 +0200 | 
|---|---|---|
| committer | Teddy Wing | 2017-09-19 16:12:55 +0200 | 
| commit | 8e8cfa6c52ff8fc2a655b768db5baafed40c1a2d (patch) | |
| tree | dbc7fc1df86820df7950be29945dc9ec4dafad9e /lib/model_attribute.rb | |
| parent | 81b3526cec5384b29752c1816577bf99c69c42c8 (diff) | |
| download | chouette-core-8e8cfa6c52ff8fc2a655b768db5baafed40c1a2d.tar.bz2 | |
Add `ModelAttribute`
This new class will allow us to generate a list of all editable fields
in all our models including the type of each field.
We need this for Compliance Control, in order to get a list of fields or
models & fields that can be selected to validate a given model
validation check. The crucial bits here are the models, fields, and the
types of those fields. These need to be defined (manually at least to
begin with), accessible, and filterable.
Refs #4401
Diffstat (limited to 'lib/model_attribute.rb')
| -rw-r--r-- | lib/model_attribute.rb | 17 | 
1 files changed, 17 insertions, 0 deletions
| diff --git a/lib/model_attribute.rb b/lib/model_attribute.rb new file mode 100644 index 000000000..be5caea94 --- /dev/null +++ b/lib/model_attribute.rb @@ -0,0 +1,17 @@ +class ModelAttribute +  cattr_reader :all + +  @@all = [] + +  attr_reader :klass, :name, :data_type + +  def self.define(klass, name, data_type) +    @@all << new(klass, name, data_type) +  end + +  def initialize(klass, name, data_type) +    @klass = klass +    @name = name +    @data_type = data_type +  end +end | 
