Skip to content

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

@shabin-slr

Description

@shabin-slr

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
=> []

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions