Sha256: 9fa144099d888cf8dffe5d598c5889ab6cd38843f0d1f8f5ff7a3555fe5ea997

Contents?: true

Size: 569 Bytes

Versions: 100

Compression:

Stored size: 569 Bytes

Contents

module Spree
  module Api
    module Responders
      module RablTemplate
        def to_format
          if template
            render template, status: options[:status] || 200
          else
            super
          end
        rescue ActionView::MissingTemplate => e
          api_behavior
        end

        def template
          options[:default_template]
        end

        def api_behavior
          if controller.params[:action] == 'destroy'
            # Render a blank template
            super
          end
        end
      end
    end
  end
end

Version data entries

100 entries across 100 versions & 1 rubygems

Version Path
spree_api-4.0.9 lib/spree/api/responders/rabl_template.rb
spree_api-4.1.15 lib/spree/api/responders/rabl_template.rb
spree_api-4.2.7 lib/spree/api/responders/rabl_template.rb
spree_api-4.3.3 lib/spree/api/responders/rabl_template.rb
spree_api-4.4.1 lib/spree/api/responders/rabl_template.rb
spree_api-4.2.6 lib/spree/api/responders/rabl_template.rb
spree_api-4.3.2 lib/spree/api/responders/rabl_template.rb
spree_api-4.4.0 lib/spree/api/responders/rabl_template.rb
spree_api-4.4.0.rc2 lib/spree/api/responders/rabl_template.rb
spree_api-4.3.1 lib/spree/api/responders/rabl_template.rb
spree_api-4.4.0.rc1 lib/spree/api/responders/rabl_template.rb
spree_api-4.3.0 lib/spree/api/responders/rabl_template.rb
spree_api-4.3.0.rc3 lib/spree/api/responders/rabl_template.rb
spree_api-4.3.0.rc2 lib/spree/api/responders/rabl_template.rb
spree_api-4.3.0.rc1 lib/spree/api/responders/rabl_template.rb
spree_api-4.2.5 lib/spree/api/responders/rabl_template.rb
spree_api-4.1.14 lib/spree/api/responders/rabl_template.rb
spree_api-4.0.8 lib/spree/api/responders/rabl_template.rb
spree_api-4.2.4 lib/spree/api/responders/rabl_template.rb
spree_api-3.7.14.1 lib/spree/api/responders/rabl_template.rb