Class: ActiveElement::JsonFieldSchema
- Inherits:
-
Object
- Object
- ActiveElement::JsonFieldSchema
- Defined in:
- lib/active_element/json_field_schema.rb
Overview
Generates a schema for a JSON form field based on values stored in the database.
Instance Method Summary collapse
-
#initialize(table:, column:) ⇒ JsonFieldSchema
constructor
A new instance of JsonFieldSchema.
- #schema ⇒ Object
Constructor Details
#initialize(table:, column:) ⇒ JsonFieldSchema
Returns a new instance of JsonFieldSchema.
6 7 8 9 |
# File 'lib/active_element/json_field_schema.rb', line 6 def initialize(table:, column:) @table = table @column = column end |
Instance Method Details
#schema ⇒ Object
11 12 13 |
# File 'lib/active_element/json_field_schema.rb', line 11 def schema data.map { |datum| structure(datum) } end |