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
Hey there, I'm using Dish in RubyMotion and I really love it! Thanks so much for creating this library and making it compatible with RM!
Question about getting a reference to an object's parent...
I have:
{ id: 12, items: [{ name: "test1" },{ name: "test2" }] }
Defined by:
class Order < Dish::Plate coerce :items, Item end class Item < Dish::Plate end
Is there a way to get an item's parent (Order) id?
Order
# my_item is an Item my_item.parent # Order object my_item.parent.id # 12
Or if not, is there perhaps a way to set a weakref to the parent when initializing the objects?
class Order < Dish::Plate # Something like this? coerce :items, ->(value) { Item.new(value, self) } end class Item < Dish::Plate def initialize(hash, parent) super @parent = WeafRef.new(parent) end end
Any ideas? Thanks again for the great library!
The text was updated successfully, but these errors were encountered:
It's not possible right now, but I'll keep it in mind. Think it's a good idea. Thanks.
Sorry, something went wrong.
No branches or pull requests
Hey there, I'm using Dish in RubyMotion and I really love it! Thanks so much for creating this library and making it compatible with RM!
Question about getting a reference to an object's parent...
I have:
Defined by:
Is there a way to get an item's parent (
Order
) id?Or if not, is there perhaps a way to set a weakref to the parent when initializing the objects?
Any ideas? Thanks again for the great library!
The text was updated successfully, but these errors were encountered: