Module: Hanami::Entity::ClassMethods Private
- Defined in:
- lib/hanami/entity.rb
Overview
This module is part of a private API. You should avoid using this module if possible, as it may be removed or be changed in the future.
Class level interface
Instance Attribute Summary collapse
- #schema ⇒ Object private
Instance Method Summary collapse
-
#attributes(type = nil, &blk) ⇒ Object
private
Define manual entity schema.
Instance Attribute Details
#schema ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
105 106 107 |
# File 'lib/hanami/entity.rb', line 105 def schema @schema end |
Instance Method Details
#attributes(type = nil, &blk) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Define manual entity schema
With a SQL database this setup happens automatically and you SHOULD NOT use this DSL. You should use only when you want to customize the automatic setup.
If you’re working with an entity that isn’t “backed” by a SQL table or with a schema-less database, you may want to manually setup a set of attributes via this DSL. If you don’t do any setup, the entity accepts all the given attributes.
86 87 88 89 |
# File 'lib/hanami/entity.rb', line 86 def attributes(type = nil, &blk) self.schema = Schema.new(type, &blk) @attributes = true end |