Thanks for the conditional_get tip.

When looking at the api for stale? and fresh_when, I see that these
methods are part of action controller.  I would like to use this
methodology to determine if an rss feed should be updated or not.  The
validation process all resides in the Feed model and a related module,
so when I try to use the stale? method, I get an undefined method
error.  Would it be better to recreate the source code in my module,
or is this the first indication that what I am trying to do is going
about it the wrong way?  I would very much like to keep the process in
a module, as I am using a template pattern to define several different
caching methods for experiments on speed and agility.

Any suggestions or advice you may have on this subject would be
greatly appreciated!

Thanks!

Jay

On Apr 21, 5:13 pm, Dmitry Sokurenko <[email protected]>
wrote:
> Yep, there are built in functionality to support conditional requests
> (bot etags and last modified). Just use it in the controller action:
>
> def some_action
>  if stale?(:last_modified => @post.updated_at.utc, :etag => @post)
>    respond_to do |format|
>      # generate a full response
>    end
>  end
>  # otherwise cached will be used
> end
>
> See:http://ryandaigle.com/articles/2008/10/25/what-s-new-in-edge-rails-ev...
>
> Dmitry
--~--~---------~--~----~------------~-------~--~----~
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