Rails caches_page, XML, and RESTful APIs
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?
精彩评论