2

I'd love to be able to use Rails' native form infrastructure for managing nested relationships.

The Changelog makes reference to accepts_nested_attributes_for, but it does not seem to work.

Can I add properties to ActiveNode that are functions instead and manually manage the creation of related models?

David Chouinard
  • 6,466
  • 8
  • 43
  • 61

1 Answers1

1

Interesting. I'd have to look deeper to say for sure, but since ActiveNode uses ActiveModel, it seems like setting a <attribute>_attributes= method might help. See these links:

https://coderwall.com/p/kvsbfa/nested-forms-with-activemodel-model-objects

https://github.com/plataformatec/simple_form/wiki/Use-with-ActiveModel-compliant-models

I haven't tried it myself, but if that doesn't help then open an issue on the repo and we can take a look

Brian Underwood
  • 10,746
  • 1
  • 22
  • 34
  • Very interesting. I'm adding an `attr_accessor` and a `..._attributes` method to the model and using `fields_for` in the view. The nested fields don't appear. However, if I remove the `..._attributes` method (but keep the `attr_accessor`), the fields appear. I believe I'm doing this right, I'll open an issue. – David Chouinard Apr 15 '15 at 17:46