On Mon, May 11, 2009 at 2:36 AM, Diarmuid <[email protected]
> wrote:

>
> I am using caches_page to cache a controller action which returns
> javascript
>
>  caches_page :show_county
>
>  def show_county
>    @county = County.find(params[:id])
>
>    respond_to do |format|
>      format.js
>    end
>
>
>  However when I hit the page, the server caches it as a html:
>
> Cached page: /home/show_county/22.html (1.1ms)
>
> This is obviously causing problems on subsequent hits.
> I am using rails 2.2.2
>
> Any ideas on why the page is cached as .html and how do I rectify
> this?
>
> Diarmuid
>

Diamuid, this is the standard behavior of caches_page.  If you're
looking to cache only HTML, I would recommend the following:

caches_page :show_county, :if => Proc.new { |c| c.request.format.html? }

Good luck,

-Conrad

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to