cadego blog

Ein weiteres tolles WordPress-Blog

cadego blog header image 2

Bug oder Müdigkeit

Januar 17th, 2012 · Keine Kommentare

Hatte gestern eine kleine Exception im Production.
Wo es Sinn macht, arbeite ich mit before_filter & after_filter.
Im Development lief alles rund aber im Production löste der after_filter die Exception aus.
Bin mir nicht sicher, ob es am caches_action lag, da der Fehler genau einmal auftrat.

class ProductsController < ApplicationController
layout 'products'
before_filter :find_or_initialize_category, :only=>[:show]
before_filter :find_product, :only=>[:show]  #..]
after_filter :set_landing_hit, :only=>[:show] #..]
caches_action :show

def show
    if stale?(:last_modified => @product.updated_at.utc, :etag => @product)
      respond_to do |format|
        format.html
      end
    end
end
protected
def find_or_initialize_category
@current_category = Category.find_by_permalink(params[:category]) || raise(ActiveRecord::RecordNotFound)
end
def find_product
@product = Product.public.find_by_permalink_and_category_id(params[:product],@current_category.id)
end
def set_landing_hit
#snip
@product.hit!
#snap
end
end

No related posts.

Tags: rails