We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Okay, so the title is a bit screwey, but here's the example:
class CartTwin collection :redemptions, twin: RedemptionTwin property :discount_cents end class RedemptionTwin property :cart end
Okay, everything looks good so far.
cart = Cart.find_by(id: '...') cart.redemptions.count # => 2 cart.redemptions.map(&:class) # => [Redemption, Redemption] cart.class # => Cart twin = CartTwin.new(cart) twin.redemptions.count # => 2 twin.redemptions.map(&:class) # => [RedemptionTwin, RedemptionTwin] twin.redemptions.map(&:model).map(&:class) # => [Redemption, Redemption] twin.class # => CartTwin twin.model.class # => Cart
Still fine, but now:
shadow = CartTwin.new(twin) shadow.class # => CartTwin shadow.model # => Cart
Amazing! Each new subsequent twinning will pick up the correct properties, but know the right model. Perfect, until...
model
shadow.redemptions.map(&:class) # => [RedemptionTwin, RedemptionTwin] shadow.redemptions.map(&:model).map(&:class) # => [RedemptionTwin, RedemptionTwin]
Uh-oh.
shadow.redemptions.map(&:model).map(&:model).map(&:class) # => [Redemption, Redemption]
The text was updated successfully, but these errors were encountered:
Hahahaha I love that title! ❤️
Sorry, something went wrong.
<3
Amazing! Each new subsequent twinning will pick up the correct properties, but know the right model.
Turns out I was wrong about this. I was very sure this was the case when I tried it a week ago, but it no longer seems to be the case.
So I guess this isn't a bug, so much as a feature request now.
No branches or pull requests
Okay, so the title is a bit screwey, but here's the example:
Okay, everything looks good so far.
Still fine, but now:
Amazing! Each new subsequent twinning will pick up the correct properties, but know the right
model
. Perfect, until...Uh-oh.
The text was updated successfully, but these errors were encountered: