small medium large xlarge

Wake_avatar_pragsmall
11 Oct 2009, 02:10
carlos souza (1 post)

On ch 22 (Caching) there’s the ContentController:

class ContentController < ApplicationController
  before_filter :verify_premium_user, :except => :public_content

  caches_page   :public_content
  caches_action :premium_content

  def public_content
    @articles = Article.list_public
  end

  def premium_content
    @articles = Article.list_premium
  end
  ...
  def update_article
    article = Article.find(params[:id])
    if article.update_attributes(params[:article])
      expire_action :action => "premium_content", :id => article
    else
      # ...
    end
  end
end

</code>

Since neither the premium_content action nor the list_premium method in the Article class receive any params, why does the article id need to be passed to the expire_action method ? Can’t we just pass the action name to the expire_action method, like the example below ?

	expire_action :action => "premium_content"

</code>

Thanks in advance.

You must be logged in to comment