joakimk/minimapper

Entity#attributes should only include declared attributes

Opened this issue · 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.