Module: Kiosk::ResourceController
- Defined in:
- lib/kiosk/resource_controller.rb
Instance Method Summary collapse
- #show ⇒ Object
-
#update ⇒ Object
Can be used as an endpoint for the CMS to expire the cache.
Instance Method Details
#show ⇒ Object
3 4 5 |
# File 'lib/kiosk/resource_controller.rb', line 3 def show self.resource = resource_model.find_by_slug(params[:id] || params[:slug]) end |
#update ⇒ Object
Can be used as an endpoint for the CMS to expire the cache.
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/kiosk/resource_controller.rb', line 9 def update model = resource_model if model.respond_to?(:expire) resource = model.new(params) # Expire for all target locales if the resource is localizable if model.respond_to?(:localized_to) I18n.available_locales.each do |locale| model.localized_to(locale) do resource.expire end end end # Expire without the explicit target locales as well resource.expire end render :nothing => true end |