Great gem, thank you for sharing! Very convenient when you need to build classes composed of data from a whole bunch of tables, and using models is too slow.
It does not handle polymorphic associations correctly; the '*_type' column is ignored, so you may get the wrong data in situations where two different parent models share the same id.
For example:
class Child < ApplicationRecord
belongs_to :parent, polymorphic: true
end
class One < ApplicationRecord
has_one :child, as: :parent
end
class Two < ApplicationRecord
has_one :child, as: :parent
end
One.create(id: 1, child: Child.new)
Two.create(id: 1, child: Child.new)
Two.all.deep_pluck(child: [:id]) == One.all.deep_pluck(child: [:id]) # Should not be true!
Great gem, thank you for sharing! Very convenient when you need to build classes composed of data from a whole bunch of tables, and using models is too slow.
It does not handle polymorphic associations correctly; the '*_type' column is ignored, so you may get the wrong data in situations where two different parent models share the same id.
For example:
I will try and figure out a PR.