Is it possible to do a fragment caching in a rabl view?
Asked Answered
B

1

6

I'm trying to do something like this:

cache "api/v1/cars_index/#{I18n.locale}/car/#{car.cache_key}" do
  attributes :id, :brand, :model_name, :fuel, :km, :year, :price
  node(:color) { |car| car.color.present? ? car.color : '' }
end
Bathurst answered 5/12, 2011 at 10:57 Comment(0)
N
3

For those people who finds this question through a search or google.

Niels started an issue on Github which can be found here.

A developer created a great solution for this which has been merged into rabl since v0.6.2.

Nice answered 21/3, 2012 at 17:1 Comment(1)
Cool - I wasn't aware that this has been solved :-D I'll implement straight away!!!!!!!!!!!!!!!!!Bathurst

© 2022 - 2024 — McMap. All rights reserved.