Skip to content

Query::Builder#first and last break pagination parameters #292

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

Closed
gaorlov opened this issue Aug 24, 2018 · 1 comment
Closed

Query::Builder#first and last break pagination parameters #292

gaorlov opened this issue Aug 24, 2018 · 1 comment
Assignees

Comments

@gaorlov
Copy link
Collaborator

gaorlov commented Aug 24, 2018

Example:

scope = Example::User.where( name: "Greg" )
scope.first

# scope is set to
#<JsonApiClient::Query::Builder:0x000055dafec45c50 @klass=Example::Client::User, @primary_key=nil, @pagination_params={"page"=>1, "per_page"=>1}, @path_params={}, @additional_params={}, @filters={:name=>"Greg"}, @includes=[], @orders=[], @fields=[], @to_a=[#<Example::Client::User:@attributes={"type"=>"users", "id"=>1, "name"=>"Greg"}>]>

scope.all
# will call find on whatever is already there and only return the first record

scope.paginate( page: 10, :per_page: 100).first
# will eat all the pagination params and return only the first record
@gaorlov
Copy link
Collaborator Author

gaorlov commented Aug 24, 2018

This can be assigned to me and I'll propose a fix in the next few weeks.

@gaorlov gaorlov self-assigned this Aug 24, 2018
gaorlov added a commit that referenced this issue Aug 27, 2018
@gaorlov gaorlov closed this as completed Aug 27, 2018
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

1 participant