-
Notifications
You must be signed in to change notification settings - Fork 324
Open
Description
I'm just getting started with her, so let me know if I'm simply doing it wrong.
When a nested resource is null, I'd expect blank?
to return true but it returns false.
Here's a stripped down version of my code and the resource:
class Thing
include Her::Model
has_one :photo
end
class Photo
include Her::Model
end
...
[
{
id: 1,
name: "Something",
photo: null
},
{
id: 2,
name: "Something else",
photo: {
id: 101,
url: "http://example.com/image.png"
}
}
]
...
things = Thing.all()
things[1].photo.url # => "http://example.com/image.png"
things[0].photo.blank? # => false
things[0].photo.url # => NoMethodError: undefined method `empty?' for nil:NilClass
Is this a bug or do I have my models set up incorrectly? Thanks.
Metadata
Metadata
Assignees
Labels
No labels