search for: cache_sweeper

Displaying 14 results from an estimated 14 matches for "cache_sweeper".

2008 Mar 06
3
cache_sweeper
Hi, Why is cache_sweeper not a documented method? I was pretty sure it used to be, but I could be wrong. I can''t seem to find any information on it anymore in the online docs. As a side note, looking at the code for cache_sweeper it appears to only work with the :only option, not :except (ignores it)... what...
2006 Jan 25
1
cache_sweeper causes undefined method error
I created a sweeper ItemSweeper and saved it in app/models/item_sweeper.rb. Then I put this in my item_controller.rb: cache_sweeper :item_sweeper, :only => [:create, :destroy, :update] But now when I call the view action, I get this error: ActionView::TemplateError (undefined method `title'' for nil:NilClass) on line #5 of app/views/item/view.rhtml: 5: <H1 id="item_title"><%...
2008 Mar 27
2
rake only works once from rails
...there - maybe a Railser has dealt with this issue... I''ve made a rake task that I''m running from my rails, and it works - but only once. If I then restart the server (mongrel) it works again - once. I can simulate this in the console session as shown... q = Rake::Task["cache_sweeper"] => <Rake::Task cache_sweeper => []> >> q.invoke => [#<Proc:0xb6d03444@./script/../config/../config/../lib/tasks/cache.rake:4>] >> q = Rake::Task["cache_sweeper"] => <Rake::Task cache_sweeper => []> >> q.invoke => nil >&g...
2006 Sep 15
2
Caching::Sweeper Access to Controller
...pe.name, :event => event, :user_id => user) a.record_version = record.version if record.respond_to?("version") a.save! end The interesting thing is that it only happens on actions within one of the controllers that are calling the cache sweeper (cache_sweeper :audit_sweeper). Any help or pointers would be much appreciated. Erik
2008 Jan 26
0
"value must be enumerable" exception when using a sweeper?
...ould be much obliged. Notes: I''m using Engines... wonder if that could cause a problem. And yet, if I ''observe'' my User model, which is part of my main app and not an engine or plugin, it still gives me the same exception. Thanks! -------------------- application.rb: cache_sweeper :commerce_sweeper -------------------- commerce_sweeper.rb: class CommerceSweeper < ActionController::Caching::Sweeper observe Product def after_save(record) end end -------------------- exception: C:/dev/ruby/lib/ruby/1.8/set.rb:275:in `+'' C:/dev/ruby/lib/ruby/gems/1.8/gem...
2006 Jan 31
2
Fragment caching and pagination
I''m just getting my hands dirty with caching. The pages I want to cache have some user specific data on them (for example "log out"). That sent me down the route of fragment caching. One of the things I want to pagination is a paginated list. My question is how is pagination and query strings handled with fragment caching? Does each page get its own fragment and query string
2007 Sep 10
2
expire_page not working
...iring staff page" expire_page( :controller => ''welcome'', :action => ''staff'' ) $stderr.puts "@@@@@ Staff Page Expired" end end In my administrative controller, I have class Admin::PeopleController < Admin::AdminBaseController cache_sweeper :person_sweeper and finally, in the public controller, I have class WelcomeController < ApplicationController caches_page :staff When I hit the public ''staff'' page, the cache file is created. When changes are made to the underlying data model, the sweeper method is invok...
2005 Apr 25
1
Problems when using sweepers with postbacks
I''m using a cache sweeper class [1] to take care of some pretty complex sweeping. However, there is a problem with the current implementation. Namely, the sweeper gets called only when an action named in cache_sweeper is called using GET. As many methods where sweeper would be useful are using postback to send the form to the same action, this causes the cache to get swept when the edit form is loaded, not when the actual editing in the db is happening. My idea to solve this would be to accept an array as...
2006 Aug 01
8
Decoupled observers for controllers?
In the Rails Recipes book the recipe "Keeping track of who did what" explains how to do decoupled observing of models. In my application I''d like to do a similar thing but watching the controllers. For example, when somebody hits the login method of the Security controller, I''d like to make a note of it. In this case I could observe the User model and watch for
2006 Jan 27
0
Cache Sweepers and runner scripts that act on models?
...ly calls the model Item: Item.create(attributes...) I''ve set up a cache sweeper which removes caches after each create/destroy/update on Item, and it works fine when accessing controllers via the web server, but apparently doesn''t work via runner. Controllers have a ''cache_sweeper'' class method, but ActiveRecords don''t (though they do have observer and filter methods, which is what sweepers are a combination of). How can I get the cache sweeper to do its job when adding items via a runner script? Am I supposed to call controller methods instead? And if...
2006 Sep 12
2
Cache sweeping and render_component (my mistake or Rails bug?)
...ing nil.controller_name where TestController is obviously my controller class name. I''m running Rails 1.1.6 on linux box. My test app which extracts the error consists of a controller which body is only: require ''sweeper'' class TestController < ApplicationController cache_sweeper :sweeper def index end def foo render :text => "foo" end end The file sweeper.rb contains my sweeper class definition: class Sweeper < ActionController::Caching::Sweeper observe Bar end Bar is an empty model, with a table bars containing only id field. I''ve...
2006 Apr 09
1
PageSweeper not working since upgrading to 1.1.1
Hi, I upgraded from 1.0 to 1.1.1, now my cache sweepers acts up. They worked perfectly before he upgrade, now I get strange errors. I have an empty controller, it looks like this: class PageElementsController < ApplicationController cache_sweeper :element_sweeper def element_container_show render :inline=>"" end end The sweeper looks like this: class ElementSweeper < ActionController::Caching::Sweeper observe PageElement end When I call the action element_container_show, I get this error: NoMethodError (You...
2007 Feb 14
4
cache sweeper not getting called
Hi, I''ve started to implement page caches but I''ve hit a brick wall getting a sweeper to clear the cache when needed. It seems that any models that I tell it to observe aren''t being observed properly. If I add the sweeper to a controller the initialize method runs, but no matter what I do the after_save/after_update callbacks aren''t running. Also if I try to
2007 Jul 29
4
Server dying with perpetual "Connection reset by peer"
I''m at a loss to explain a very strange error I''m getting. This seems to happen on our production system where we have a backgroundrb server sharing a host with a Rails app running on Mongrel. The first one or two, occasionally three, calls to a worker (direct MiddleMan calls from Rails, not scheduled) succeed, but afterwards, the server fails to initialize new workers.