it bails out when asked for an empty nested has_many relationship (undefined method `[]' for nil:NilClass) #366
Labels
Enhancement
Enhancements to existing features
Milestone
When you just created an issue, the
attachments
relationship is unusable (client.Issue.build.save.attachments
gives "undefined method [] for nil:NilClass"). That happens because attachments are nested underfields
. And in such case the parent must exist.Right now I have to do:
Alternatively:
I first tried
client.Attachment.build(issue: issue).save!(file: p)
, but it doesn't work sincebuild()
's arguments are passed down in theattrs
key. E.g.initialize()
looks inoptions[:issue]
, but the relation is inoptions[:attrs][:issue]
.The text was updated successfully, but these errors were encountered: