2012-08-09 19:59:35 -07:00
|
|
|
class ContributionObserver < ActiveRecord::Observer
|
|
|
|
def after_create(contribution)
|
|
|
|
controller.expire_fragment('outfits#new latest_contribution')
|
2012-10-24 20:09:05 -07:00
|
|
|
|
|
|
|
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
|