Class: MegaScaffold::FieldsGenerator
- Inherits:
-
Object
- Object
- MegaScaffold::FieldsGenerator
- Defined in:
- lib/mega_scaffold/fields_generator.rb
Instance Attribute Summary collapse
-
#model ⇒ Object
readonly
Returns the value of attribute model.
Instance Method Summary collapse
- #generate ⇒ Object
-
#initialize(model) ⇒ FieldsGenerator
constructor
A new instance of FieldsGenerator.
Constructor Details
#initialize(model) ⇒ FieldsGenerator
Returns a new instance of FieldsGenerator.
5 6 7 |
# File 'lib/mega_scaffold/fields_generator.rb', line 5 def initialize(model) @model = model end |
Instance Attribute Details
#model ⇒ Object (readonly)
Returns the value of attribute model.
3 4 5 |
# File 'lib/mega_scaffold/fields_generator.rb', line 3 def model @model end |
Instance Method Details
#generate ⇒ Object
9 10 11 12 13 14 15 16 |
# File 'lib/mega_scaffold/fields_generator.rb', line 9 def generate model.columns.map do |e| { name: e.name, type: MegaScaffold::TypeDetector.find_type(e), } end end |