Skip to content

v3.2.2 - Query Methods & JSON Serialization

Choose a tag to compare

@AdrianCurtin AdrianCurtin released this 09 Jan 02:18
· 32 commits to master since this release

Query Method Improvements & JSON Serialization

This release improves query methods and adds JSON serialization options.

Improvements

  • IMPROVED: latest and last_updated methods now support a limit: option when passing constraints.
Song.latest(:user.eq => user, limit: 5)
Song.last_updated(status: "active", limit: 10)
query.where(genre: "rock").last_updated(limit: 3)
  • IMPROVED: PointerCollectionProxy#as_json now supports the pointers_only option. Set pointers_only: false to serialize objects with their fetched fields instead of just pointers.
# Default - pointers for storage
capture.assets.as_json
# => [{"__type"=>"Pointer", "className"=>"Asset", "objectId"=>"abc"}, ...]

# Serialize with fetched fields
capture.assets.as_json(pointers_only: false)
# => [{"objectId"=>"abc", "file"=>{...}, "caption"=>"My photo", ...}, ...]
  • IMPROVED: Parse::Object#as_json with :only option now automatically includes identification fields (objectId, className, __type, id). Use strict: true to disable this.
# Default: identification fields included
song.as_json(only: [:title, :artist])
# => {"objectId"=>"abc", "className"=>"Song", "__type"=>"Object", "title"=>"...", "artist"=>"..."}

# Strict mode: only specified fields
song.as_json(only: [:title, :artist], strict: true)
# => {"title"=>"...", "artist"=>"..."}
  • NEW: Added :exclude as an alias for :except in as_json.
song.as_json(exclude: [:acl, :created_at])

Author: Adrian Curtin
Date: December 2025