Module: DynamoRecord::Fields::ClassMethods
- Defined in:
- lib/dynamo_record/fields.rb
Instance Method Summary collapse
Instance Method Details
#field(name, type = :string, opts = {}) ⇒ Object
14 15 16 17 18 19 20 |
# File 'lib/dynamo_record/fields.rb', line 14 def field(name, type = :string, opts = {}) named = name.to_s self.attributes.merge!(name => {type: type, options: opts}) define_method("#{named}=") { |value| write_attribute(named, value) } define_method("#{name}") { read_attribute(named) } end |