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

How to get the most recent record of a given class from parse? #128

Closed
dlio opened this issue May 30, 2014 · 2 comments
Closed

How to get the most recent record of a given class from parse? #128

dlio opened this issue May 30, 2014 · 2 comments
Labels

Comments

@dlio
Copy link

dlio commented May 30, 2014

Is there an easy lookup to simply retrieve the one most recently created record for a given class? I have been trying various workarounds with the example methods but I cannot seem to figure out how. I could use the HTTP API to do so but I'm guessing that this is a fairly common use case for this gem. Any help would be much appreciated; cheers and thanks for this great gem.

I see a proposed solution in the TODO queries but nothing that seems currently viable.
Is the only way for me to do this to use a different gem to interact directly with parse via HTTP requests manually?

see also: adelevie/parse_resource#127

@dlio
Copy link
Author

dlio commented May 30, 2014

Is there is a way to pass through any of these constraints?
https://www.parse.com/docs/rest#queries

@xavdid xavdid added the question label Jun 1, 2015
@rhymes
Copy link
Contributor

rhymes commented Jun 19, 2015

@dlio if you track the github version of the gem you can issue most of the queries and get the most recently created, for example:

most_recent = client.query('YourClass').tap do |q|
    q.order_by = 'createdAt'
    q.order = :descending
end.first

HTH

@rhymes rhymes closed this as completed Jun 19, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants