I''ve decided to dive into page caching for my rails app. I''m doing my testing with webbrick and it refuses to display the cached page for a particular action. I''ve modified my paginator helper to put the page parameter in the url so that the paginated page can be used with caching. This works perfectly when the page parameter is in the url (ie browse/2006/2 or browse/2006/1). Both of those url put the cached file in public/browse/2006/1.html and 2.html. They work fine and webbrick displays the cached version. If I leave off the trailing 1 or 2 then the cached file is created in public/browse/2006.html. The file is getting created with each request instead of serving the cached version. What can I do to fix this problem. I''m running rails 1.1 Here is my routes.rb. I think it might have something to do with the problem. map.connect ''pragmatic/browse/:id/:page'', :controller => ''pragmatic'', :action => ''browse_date'', :requirements => { :page => /\d+/}, :page => nil, :id => /\d\d\d\d/ -- Posted via http://www.ruby-forum.com/.
Are you running in the development environment? Caching only works when your environment is production. ~ Ben On 4/8/06, charlie bowman <cbowmanschool@yahoo.com> wrote:> > I''ve decided to dive into page caching for my rails app. I''m doing my > testing with webbrick and it refuses to display the cached page for a > particular action. I''ve modified my paginator helper to put the page > parameter in the url so that the paginated page can be used with > caching. This works perfectly when the page parameter is in the url (ie > browse/2006/2 or browse/2006/1). Both of those url put the cached file > in public/browse/2006/1.html and 2.html. They work fine and webbrick > displays the cached version. If I leave off the trailing 1 or 2 then > the cached file is created in public/browse/2006.html. The file is > getting created with each request instead of serving the cached version. > What can I do to fix this problem. I''m running rails 1.1 Here is my > routes.rb. I think it might have something to do with the problem. > map.connect ''pragmatic/browse/:id/:page'', > :controller => ''pragmatic'', > :action => ''browse_date'', > :requirements => { :page => /\d+/}, > :page => nil, > :id => /\d\d\d\d/ > > -- > Posted via http://www.ruby-forum.com/. > _______________________________________________ > Rails mailing list > Rails@lists.rubyonrails.org > http://lists.rubyonrails.org/mailman/listinfo/rails >-- Ben Reubenstein http://www.benr75.com -------------- next part -------------- An HTML attachment was scrubbed... URL: http://wrath.rubyonrails.org/pipermail/rails/attachments/20060408/1feaa5f0/attachment.html
whoops... didn''t read all the way through... how are you setting up the caching in your controller? On 4/8/06, Ben Reubenstein <benr@x-cr.com> wrote:> > Are you running in the development environment? Caching only works when > your environment is production. > > ~ Ben > > > On 4/8/06, charlie bowman < cbowmanschool@yahoo.com> wrote: > > > > I''ve decided to dive into page caching for my rails app. I''m doing my > > testing with webbrick and it refuses to display the cached page for a > > particular action. I''ve modified my paginator helper to put the page > > parameter in the url so that the paginated page can be used with > > caching. This works perfectly when the page parameter is in the url (ie > > > > browse/2006/2 or browse/2006/1). Both of those url put the cached file > > in public/browse/2006/1.html and 2.html. They work fine and webbrick > > displays the cached version. If I leave off the trailing 1 or 2 then > > the cached file is created in public/browse/2006.html. The file is > > getting created with each request instead of serving the cached version. > > What can I do to fix this problem. I''m running rails 1.1 Here is my > > routes.rb. I think it might have something to do with the problem. > > map.connect ''pragmatic/browse/:id/:page'', > > :controller => ''pragmatic'', > > :action => ''browse_date'', > > :requirements => { :page => /\d+/}, > > :page => nil, > > :id => /\d\d\d\d/ > > > > -- > > Posted via http://www.ruby-forum.com/. > > _______________________________________________ > > Rails mailing list > > Rails@lists.rubyonrails.org > > http://lists.rubyonrails.org/mailman/listinfo/rails > > > > > > -- > Ben Reubenstein > http://www.benr75.com >-- Ben Reubenstein http://www.benr75.com -------------- next part -------------- An HTML attachment was scrubbed... URL: http://wrath.rubyonrails.org/pipermail/rails/attachments/20060408/6b47c61a/attachment.html
Ben Reubenstein wrote:> whoops... didn''t read all the way through... how are you setting up the > caching in your controller?Here is my controler caching line caches_page :index, :view, :browse, :browse_date, :rss -- Posted via http://www.ruby-forum.com/.
charlie bowman wrote:> Ben Reubenstein wrote: >> whoops... didn''t read all the way through... how are you setting up the >> caching in your controller? > > Here is my controler caching line > caches_page :index, :view, :browse, :browse_date, :rssIt turns out the problem is in the routes.rb I''m not sure why but I had to make the following change so that there the action portion of the route wasn''t hard coded. Maybe someone knows why this works but the previous example of mine didn''t. map.connect ''pragmatic/:action/:id/:page'', :controller => ''pragmatic'', :requirements => { :page => /\d+/}, :page => nil, :id => /\d\d\d\d/ -- Posted via http://www.ruby-forum.com/.