【问题标题】:Is it possible to do a fragment caching in a rabl view?是否可以在 rabl 视图中进行片段缓存?
【发布时间】:2012-01-13 03:07:32
【问题描述】:

我正在尝试做这样的事情:

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

【问题讨论】:

    标签: ruby-on-rails api caching rabl


    【解决方案1】:

    对于那些通过搜索或谷歌找到这个问题的人。

    Niels 在 Github 上发起了一个 issue,可以在 here 找到。

    一位开发人员为此创建了一个很好的解决方案,该解决方案自 v0.6.2 起已合并到 rabl。

    【讨论】:

    • 酷 - 我不知道这已经解决了 :-D 我会立即实施!!!!!!!!!!!!!!!!!!
    猜你喜欢
    • 2012-10-22
    • 2012-04-10
    • 2015-04-24
    • 1970-01-01
    • 1970-01-01
    • 2012-07-02
    • 1970-01-01
    • 2021-09-30
    • 1970-01-01
    相关资源
    最近更新 更多