Sha256: df71a65d2946fb543054e9de182fe1829b9abf51a70c8742e4d8f35dec9a2cfb
Contents?: true
Size: 771 Bytes
Versions: 2
Compression:
Stored size: 771 Bytes
Contents
module Scrivito # @api public module CmsAccessible protected # Filter method to load a CMS object. # # To require the loading for all actions, use this in your controllers: # before_filter :load_object def load_object CmsEnv.new(request.env).load loaded_obj = request.env[CmsEnv::OBJ_ENV_KEY] raise loaded_obj if loaded_obj.is_a?(StandardError) @obj = loaded_obj end # Deliver a binary @obj by redirecting to it's `body_data_url`. # Will respond with 404 if the @obj has no blob. # @api public def deliver_file if @obj.body_data_url redirect_to enforce_protocol_from_request(@obj.body_data_url) else render text: "Empty Blob", status: 404 end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
scrivito_sdk-0.13.0 | lib/scrivito/cms_accessible.rb |
scrivito_sdk-0.12.0 | lib/scrivito/cms_accessible.rb |