Scott Carleton
2012-Dec-13 17:35 UTC
Proposal: ActionController class methods, all procs get evaluated
Specifically looking at action_cache in Rails.3.2 stable right now. It currently will evaluate procs given to the layout or cache_path as can beseen here<https://github.com/rails/rails/blob/3-2-stable/actionpack/lib/action_controller/caching/actions.rb#L135>. I''m working on a library where I''d like to tag my caches so that I can expire sets of keys easily. It would appear that something such as caches_action :show, tag: Proc.new { "post_#{params[:id]}" } would evaluate to the tag to post_1, post_2 etc but it doesn''t. It wouldn''t take much to modify the filter method linked above to evaluate all procs passed in as options. I''m going to make a pull request unless there are any objections. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group. To view this discussion on the web visit https://groups.google.com/d/msg/rubyonrails-core/-/UUqVW18mx50J. To post to this group, send email to rubyonrails-core@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-core+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-core?hl=en.
Rafael Mendonça França
2012-Dec-13 21:28 UTC
Re: Proposal: ActionController class methods, all procs get evaluated
Action cache was extracted from Rails and it is not part of the framework anymore. Rafael Mendonça França http://twitter.com/rafaelfranca https://github.com/rafaelfranca On Thu, Dec 13, 2012 at 2:35 PM, Scott Carleton <carleton.scott@gmail.com>wrote:> Specifically looking at action_cache in Rails.3.2 stable right now. > > It currently will evaluate procs given to the layout or cache_path as can > be seen here<https://github.com/rails/rails/blob/3-2-stable/actionpack/lib/action_controller/caching/actions.rb#L135>. > > > I''m working on a library where I''d like to tag my caches so that I can > expire sets of keys easily. It would appear that something such as > > caches_action :show, tag: Proc.new { "post_#{params[:id]}" } > > would evaluate to the tag to post_1, post_2 etc but it doesn''t. It > wouldn''t take much to modify the filter method linked above to evaluate > all procs passed in as options. I''m going to make a pull request unless > there are any objections. > > -- > You received this message because you are subscribed to the Google Groups > "Ruby on Rails: Core" group. > To view this discussion on the web visit > https://groups.google.com/d/msg/rubyonrails-core/-/UUqVW18mx50J. > To post to this group, send email to rubyonrails-core@googlegroups.com. > To unsubscribe from this group, send email to > rubyonrails-core+unsubscribe@googlegroups.com. > For more options, visit this group at > http://groups.google.com/group/rubyonrails-core?hl=en. >-- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group. To post to this group, send email to rubyonrails-core@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-core+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-core?hl=en.
Scott Carleton
2012-Dec-14 15:34 UTC
Re: Proposal: ActionController class methods, all procs get evaluated
Ahh. Thanks for the heads up. On Thu, Dec 13, 2012 at 4:28 PM, Rafael Mendonça França < rafaelmfranca@gmail.com> wrote:> Action cache was extracted from Rails and it is not part of the framework > anymore. > > Rafael Mendonça França > http://twitter.com/rafaelfranca > https://github.com/rafaelfranca > > > > On Thu, Dec 13, 2012 at 2:35 PM, Scott Carleton <carleton.scott@gmail.com>wrote: > >> Specifically looking at action_cache in Rails.3.2 stable right now. >> >> It currently will evaluate procs given to the layout or cache_path as can >> be seen here<https://github.com/rails/rails/blob/3-2-stable/actionpack/lib/action_controller/caching/actions.rb#L135>. >> >> >> I''m working on a library where I''d like to tag my caches so that I can >> expire sets of keys easily. It would appear that something such as >> >> caches_action :show, tag: Proc.new { "post_#{params[:id]}" } >> >> would evaluate to the tag to post_1, post_2 etc but it doesn''t. It >> wouldn''t take much to modify the filter method linked above to evaluate >> all procs passed in as options. I''m going to make a pull request unless >> there are any objections. >> >> -- >> You received this message because you are subscribed to the Google Groups >> "Ruby on Rails: Core" group. >> To view this discussion on the web visit >> https://groups.google.com/d/msg/rubyonrails-core/-/UUqVW18mx50J. >> To post to this group, send email to rubyonrails-core@googlegroups.com. >> To unsubscribe from this group, send email to >> rubyonrails-core+unsubscribe@googlegroups.com. >> For more options, visit this group at >> http://groups.google.com/group/rubyonrails-core?hl=en. >> > > -- > You received this message because you are subscribed to the Google Groups > "Ruby on Rails: Core" group. > To post to this group, send email to rubyonrails-core@googlegroups.com. > To unsubscribe from this group, send email to > rubyonrails-core+unsubscribe@googlegroups.com. > For more options, visit this group at > http://groups.google.com/group/rubyonrails-core?hl=en. >-- Scott Carleton Artsicle, Founder / CTO scott@artsicle.com // www.artsicle.com C. 914 400 5085 www.twitter.com/artsicle www.scottcarleton.com -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group. To post to this group, send email to rubyonrails-core@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-core+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-core?hl=en.