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 trying to set up an API that uses Sequel. Trying to present a collection throws this error:
NoMethodError: Entities::Event missing attributename' on #Sequel::Postgres::Dataset:0x007fe4861eb078`
This works with ActiveRecord, but not with Sequel. The check for if an object is a collection is done by checking if the .to_arymethod exists on an object. This is true for ActiveRecord, but not for Sequel.
I've made a small workaround to make it work for now, but I feel this should be part of Grape Entity and not Sequel.
I'm trying to set up an API that uses Sequel. Trying to present a collection throws this error:
NoMethodError: Entities::Event missing attribute
name' on #Sequel::Postgres::Dataset:0x007fe4861eb078`This works with ActiveRecord, but not with Sequel. The check for if an object is a collection is done by checking if the
.to_ary
method exists on an object. This is true for ActiveRecord, but not for Sequel.I've made a small workaround to make it work for now, but I feel this should be part of Grape Entity and not Sequel.
Is there a more reliable way to check if an object is a collection? Such as doing a check on
.to_a
? Or to check if it is somehow Enumerable?Example setup:
The text was updated successfully, but these errors were encountered: