Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Model.all returns empty array, but response has data #550

Open
shabin-slr opened this issue Sep 21, 2023 · 1 comment
Open

Model.all returns empty array, but response has data #550

shabin-slr opened this issue Sep 21, 2023 · 1 comment

Comments

@shabin-slr
Copy link

I'm getting below raw response to api calls but in variable the data is always an empty array. The api response is in JSON format. What could be the issue?

irb(main):002:0>y MyApi::MyModal.all.fetch
--- !ruby/object:Her::Model::Relation
parent: !ruby/class 'MyAPI::MyModel'
params:
  :page: 1
  :per_page: 2
_fetch: !ruby/array:Kaminari::PaginatableArray
  internal: []
  ivars:
    :@_padding: 0
    :@_total_count: 0
    :@_offset_value: 0
    :@_limit_value: 2
    :@_original_array: !ruby/array:Her::Collection
      internal:
      - !ruby/object:MyAPI::MyModel
        metadata: {}
        response_errors: {}
        destroyed: false
        attributes: !ruby/hash:ActiveSupport::HashWithIndifferentAccess
          my_model: !ruby/hash:ActiveSupport::HashWithIndifferentAccess
            id: 1
            first_name: Test
            last_name: Name
            phone_number: '9112345678901'
            opted_in: false
            deleted_at: 
            created_at: '2023-09-20T12:52:05.700Z'
            updated_at: '2023-09-20T12:52:05.700Z'
        changed_attributes: !ruby/hash:ActiveSupport::HashWithIndifferentAccess
          my_model: 
      - !ruby/object:MyAPI::MyModel
        metadata: {}
        response_errors: {}
        destroyed: false
        attributes: !ruby/hash:ActiveSupport::HashWithIndifferentAccess
          my_model: !ruby/hash:ActiveSupport::HashWithIndifferentAccess
            id: 2
            first_name: test
            last_name: name
            phone_number: '78946513060'
            opted_in: false
            deleted_at: 
            created_at: '2023-09-20T13:14:29.363Z'
            updated_at: '2023-09-20T13:14:29.363Z'
        changed_attributes: !ruby/hash:ActiveSupport::HashWithIndifferentAccess
          my_model: 
      ivars:
        :@metadata: {}
        :@errors: {}
irb(main):002:0> MyApi::MyModal.all.fetch
=> []
@pboling
Copy link

pboling commented Mar 28, 2024

This gem has some major bugs, and is essentially unmaintained since 2016. I recommend checking out https://github.com/balvig/spyke.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants