You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
The text was updated successfully, but these errors were encountered:
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:
Is this a bug or do I have my models set up incorrectly? Thanks.
The text was updated successfully, but these errors were encountered: