开发者

Rails caches_page, XML, and RESTful APIs

开发者 https://www.devze.com 2023-01-01 11:54 出处:网络
My app exposes a RESTful API using map.resources (eg: map.resources :comments).My comments controller caches_page :index, :show.In this way, I expose an XML API, so that a Flex app can post new commen

My app exposes a RESTful API using map.resources (eg: map.resources :comments). My comments controller caches_page :index, :show. In this way, I expose an XML API, so that a Flex app can post new comments. (eg POST to /comments.xml). This all worked fine until I enabled caching using the default filesystem store. Now, as far as I can tell, the cached file (/comments.xml) is generated, but any POSTs to /comments.xml hit the 开发者_运维技巧cached file rather than being routed into Rails and processed. If I delete the cached file, the first POST goes through (and then the cache is refreshed), but no more.

Is there a best-practices way of setting this up so that the POST will work? I could create a non-cached endpoint, but then the setup stops being intuitively RESTful. Thoughts?

0

精彩评论

暂无评论...
验证码 换一张
取 消