{"action":"opened","issue":{"url":"https://api.github.com/repos/rom-rb/rom-mapper/issues/30","labels_url":"https://api.github.com/repos/rom-rb/rom-mapper/issues/30/labels{/name}","comments_url":"https://api.github.com/repos/rom-rb/rom-mapper/issues/30/comments","events_url":"https://api.github.com/repos/rom-rb/rom-mapper/issues/30/events","html_url":"https://github.com/rom-rb/rom-mapper/issues/30","id":127656810,"number":30,"title":"model dsl modify constructor signature of model class","user":{"login":"mmeeoorroo","id":5418700,"avatar_url":"https://avatars.githubusercontent.com/u/5418700?v=3","gravatar_id":"","url":"https://api.github.com/users/mmeeoorroo","html_url":"https://github.com/mmeeoorroo","followers_url":"https://api.github.com/users/mmeeoorroo/followers","following_url":"https://api.github.com/users/mmeeoorroo/following{/other_user}","gists_url":"https://api.github.com/users/mmeeoorroo/gists{/gist_id}","starred_url":"https://api.github.com/users/mmeeoorroo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mmeeoorroo/subscriptions","organizations_url":"https://api.github.com/users/mmeeoorroo/orgs","repos_url":"https://api.github.com/users/mmeeoorroo/repos","events_url":"https://api.github.com/users/mmeeoorroo/events{/privacy}","received_events_url":"https://api.github.com/users/mmeeoorroo/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2016-01-20T10:53:51Z","updated_at":"2016-01-20T10:53:51Z","closed_at":null,"body":"Assume we have an model `Entities::Product` without any constructor, or a constructor without param:\r\n\r\n```ruby\r\nmodule Entities\r\n  class Product\r\n    attr_accessor :name, :id, :price, :category\r\n\r\n    # def initialize\r\n    # \r\n    # end\r\n  end\r\nend\r\n```\r\n\r\nand a mapper:\r\n\r\n```ruby\r\nrequire 'rom'\r\nrequire 'rom-mapper'\r\n\r\nmodule Mappers\r\n  class Product < ROM::Mapper\r\n    symbolize_keys true\r\n    reject_keys true\r\n\r\n    model name: Entities::Product.name\r\n\r\n    attribute :name\r\n    attribute :price\r\n    attribute :category\r\n    attribute :id\r\n  end\r\nend\r\n```\r\n\r\nhere we can create an product instance normally using its constructor:\r\n\r\n```ruby\r\np1 = Entities::Product.new\r\n```\r\n\r\nor using rom-mapper\r\n\r\n```ruby\r\ninput = [\r\n    {\r\n        'id' => 'id1',\r\n        'name' => 'product mot',\r\n        'price' => 12.0,\r\n        'category' => 'mobile'\r\n    }\r\n]\r\nmapper = Mappers::Product.build\r\noutput = mapper.call input\r\nputs output[0].inspect\r\n```\r\n\r\nAfter calling/using the mapper, we cannot create product instance using constructor-with-zero-param any more, but we can call the constructor with an param, e.g. an empty hash:\r\n\r\n```\r\np2 = Entities::Product.new # this raises: ArgumentError: wrong number of arguments (0 for 1)\r\np3 = Entities::Product.new({}) # this is fine\r\n```\r\n\r\nAm I doing something wrong or this is the way rom-mapper work? Please give me some advise.\r\n\r\nThanks"}}