Rails action caching with querystring parameters

前端 未结 3 1284
滥情空心
滥情空心 2020-11-30 19:20

How can I cache my REST controller with Rails where my actions have query string parameters?

Example: GET /products/all.xml?max_price=200

T

3条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2020-11-30 20:17

    To use the request url as cache key I do something like this:

    caches_action :index, :cache_path => Proc.new {|c| c.request.url }
    

提交回复
热议问题