impress/app/models/contribution_observer.rb

17 lines
418 B
Ruby
Raw Normal View History

2012-08-09 19:59:35 -07:00
class ContributionObserver < ActiveRecord::Observer
def after_create(contribution)
controller.expire_fragment('outfits#new latest_contribution')
if contribution.contributed_type == 'SwfAsset'
item = contribution.contributed.item
controller.expire_fragment("items/#{item.id} contributors")
end
2012-08-09 19:59:35 -07:00
end
private
def controller
@controller ||= ActionController::Base.new
end
end