Open ProGM opened 8 years ago
The easiest way would be to hack in our own implementation of this method with a signature matching ActiveRecord's. I can think of an easy enough way to do it, having that class method register the lesson_attributes
method in such a way that it will delegate correctly during mass-assignment.
Alternatively, we could use this as motivation to start adapting our own versions of the ActiveRecord::Reflection
and ActiveRecord::NestedAttributes
public interfaces to not only provide this method but compatibility with gems that rely on them. This is something we've needed for a while but not so crucial that it needs to happen immediately, so I'd weigh the cost of a "hack-it-in-and-make-it-work" implementation VS a Neo4jrb-flavored implementation of complicated interfaces from ActiveRecord.
I checked a bit. It seems like ActiveRecord::NestedAttributes
is strictly linked to AutosaveAssociation
and Reflection
, so I would need to implement both.
If I'll get some time, I'll try to
Yeah, I checked this out back in September 2014 and came to the same conclusion. At the time, I implemented a really basic Reflection
class, https://github.com/neo4jrb/neo4j/blob/master/lib/neo4j/active_node/reflection.rb, but I think I'd approach it differently now. We ended up getting our original implementation of association_cache
from that experiment but I ultimately had to back off, it was just too much for me back then.
Let me know if I can help. I'm happy to pitch in with this. Now that the ActiveAttr
thing is done, I need a new task. :-)
Then no way to use gems like cocoon with neo4j.rb or create dynamic nested form in an easy way ?
Alternatively, we could use this as motivation to start adapting our own versions of the ActiveRecord::Reflection and ActiveRecord::NestedAttributes public interfaces to not only provide this method but compatibility with gems that rely on them
Any way to do this now?
Is this planned to be implemented? Is there a substitute way to do this documented anywhere?
Sorry for the delay. No current plans to do this. I'd should be able to look over a PR, though.
@cheerfulstoic so what's the recommended way of saving a model along with multiple associated objects?
I tried the "monkey way":
But it crashes with a
block in accepts_nested_attributes_for': undefined method _reflect_on_association
Any easy solution to have nested attributes in neo4jrb?