Hey Jeremy,

Am using the JSON Serializer plugin.

Am defining the includes on a Transaction Model, like this:

  plugin :json_serializer, :include=> [ :messages, :transfers, :user ]

I make the query in the controller and merge that with some other data in a 
hash and then call:

  JSON(data)

To format my response.
This formats the data for me, and my joining models are included.


I have another expensive controller method which I want don't want to 
include any of the joining models, and only some of the data.

The below wont work because I have created a hash around the model.
plugin :json_serializer

data.to_json(:include=> [ :messages, :transfers, :user ])
data.to_json(:only=> [ :lat, :lng])


To get around this I am thinking of using:
  Sequel::Plugins::JsonSerializer.configure(Sequel::Model::Transaction, 
{:include=>[], only: [:lat, :lng]})

To override the configuration, and then resetting it afterwards.


Is there a nice way to do this, or am I going to have to rethink how I am 
using the JSON serializer plugin?


Thanks for your time,
Matt

-- 
You received this message because you are subscribed to the Google Groups 
"sequel-talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/sequel-talk.
For more options, visit https://groups.google.com/d/optout.

Reply via email to