Posts

Showing posts with the label cocoon-gem

Double nested association w/ Cocoon and Polimorphism gets rejected

Image
Clash Royale CLAN TAG #URR8PPP Double nested association w/ Cocoon and Polimorphism gets rejected So, I have a model Label which is polymorphic and another model Stuff which is not. A stuff can have many labels (may also called groups), and each and every one of them can also have a label . I am working with the Cocoon gem to try to add these resource on to a sigle edit/new form (the Stuff one). The problem is that when I try to update the stuff with a new group (with new labels in it), it says this Labels lables labelable must exist . I think that that's an error given becouse the first lable(group) is not yet saved to the database, so it can't give his nested lable an id. (not sure though) Label Stuff Stuff Labels lables labelable must exist Also, is this the best way to do that? I mean, I made the label polymorphic only because I needed to save a only a string, and it would be unpractical and it would have taken database storage for nothing... Enough talking, here...