minimapper icon indicating copy to clipboard operation
minimapper copied to clipboard

Entity#attributes should only include declared attributes

Open henrik opened this issue 11 years ago • 0 comments

Current behaviour:

class MyEntity
  include Minimapper::Entity

  attribute :my_attrib
  attr_accessor :my_accessor
end

e = MyEntity.new(my_attrib: 1, my_accessor: 2)
e.attributes # => { my_attrib: 1, my_accessor: 2 }

Expected behavior:

e = MyEntity.new(my_attrib: 1, my_accessor: 2)
e.attributes # => { my_attrib: 1 }

Since mappers will attempt to persist the attributes, the current behaviour means you can't have "virtual attributes" that don't correspond exactly to a DB column.

henrik avatar Jul 18 '13 06:07 henrik