Skip to content

non-cacheable fields #1

Description

@deepsystm

Hi ElMassimo, thanks for your work, amazing and fast lib!

I have a few questions:

  1. How do I make fields in the serializer that are always obtained by querying a value rather than a cached version of the value?
class MixSerializer < Oj::Serializer
  has_one     :user, serializer: UserListItemSerializer

  attributes  :id, 
              :field_that_never_been_cached,
              :title


  attribute \
  def field_that_never_been_cached
    get_updated_data
  end

end
  1. How to pass additional data to the serializer besides the serialization object itself? For example current_user object from Devise
render json: AlbumSerializer.one(album, current_user: current_user) if signed_in?

Thanks!

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