Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Extract mapper-related features into rom-mapper #349

Closed
wmaciejak opened this issue Aug 5, 2016 · 1 comment
Closed

Extract mapper-related features into rom-mapper #349

wmaciejak opened this issue Aug 5, 2016 · 1 comment
Milestone

Comments

@wmaciejak
Copy link

wmaciejak commented Aug 5, 2016

Issue discovered while upgrading ROM to version 2.0.0.

rom (= 2.0.0) was resolved to 2.0.0, which depends on
      rom-mapper (~> 0.4.0)

Other, related issue - when you will try use mapper on combined records, then you will see warnings like this

[1] pry(#<UserRepository>)> users.combine(one: { settings: [settings.for_org(org), id: :user_id] }).as(:entity).to_a
/Users/user/.rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/transproc-0.4.0/lib/transproc/hash.rb:246: warning: wrong element type Hash at 0 (expected array)
/Users/user/.rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/transproc-0.4.0/lib/transproc/hash.rb:246: warning: ignoring wrong elements is deprecated, remove them explicitly
/Users/user/.rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/transproc-0.4.0/lib/transproc/hash.rb:246: warning: this causes ArgumentError in the next release
=> [{:settings=>{:active=>false}}, {:settings=>{:active=>false}}]

Mapper are very simple

module UserMappers
  class Entity < ROM::Mapper
    relation :users
    register_as :entity
    reject_keys true

    attribute :id
    attribute :code
    attribute :name
    attribute :settings do |settings|
      settings ? settings[:value].deep_symbolize_keys : { active: false }
    end
  end
end
@solnic solnic added this to the 2.1.0 milestone Aug 5, 2016
@solnic solnic modified the milestones: 3.0.0, 2.1.0 Nov 11, 2016
@solnic solnic modified the milestones: 4.0.0, 3.0.0 Jan 12, 2017
@solnic
Copy link
Member

solnic commented Jun 7, 2017

Done in master

@solnic solnic closed this as completed Jun 7, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants