You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
There are two options. One would be to create a new association on User called published_posts and then point Brainstem at that. That's probably easiest. You can also give Brainstem a lambda when using association and return anything you want. This will be less efficient because it can't eager load the way it does with associations, but it would work.
Finally, if you're interested, I think allowing filters on associations would be a great general addition to the next version of Brainstem.
Hey @cantino,
Using a published_posts association works perfectly.
Using a lambda gives an additional problem that the response cannot be cached with memcache, as ruby cannot serialize Procs.
V
I got a user with posts. Some posts are not published.
If I do user.json?include=posts this will give me all posts for that user. Is it possible to restrict it to just posts that are published?
Best,
Vinny
The text was updated successfully, but these errors were encountered: