Rails is caching the index method of one of my controllers. It's a very simple application and only has like 2 controllers and a handful of actions each. The weird thing is I don't have any caching in my application at all, at least not explicitly. The pages get uncached if I restart passenger. Does rails do some kind of automatic page caching?
- There are no files in the
public
directory - The page is returning a
200
header - I have no caching blocks in my views (I use haml, if that matters)
- I have no action, controller, or page caching defined
- The request is hitting rails, verified by the production log
I have the following in my production.rb:
config.cache_classes = true
config.action_controller.consider_all_requests_local = false
config.action_controller.perform_caching = true
config.action_view.cache_template_loading = true
The problem is it isn't showing any Releases
in the table
in my view, yet it will if I restart passenger. The reason I know this is failing is because I can fire up the Rails console and do Release.ready
, which is the named scope being displayed in the view, and I actually get some results back.
Here is the relevant code:
models/release.rb
class Release < ActiveRecord::Base
default_scope :order => 'created_at DESC'
named_scope :ready, :conditions => ['show_on <= ? AND is_deleted = ?', Time.now, false]
end
controllers/releases_controller.rb
class ReleasesController < ApplicationController
def index
@releases = Release.ready
end
end
views/releases/index.html.haml
%table{:border => 1}
%tr
%th Date
%th Title
%th Artist
%th Song
- @releases.each do |release|
- @release = release
%tr[release]
%td
= link_to_remote "delete", :url => release, :method => :delete , :confirm => 'Remove?'
= release.created_at.to_date.to_s(:long_ordinal)
%td= link_to release.title, release.url
%td= in_place_editor_field :release, :artist
%td= in_place_editor_field :release, :song