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.2.3.1 lib/spree/api/responders/rabl_template.rb
spree_api-4.1.13.1 lib/spree/api/responders/rabl_template.rb
spree_api-4.0.7.1 lib/spree/api/responders/rabl_template.rb
spree_api-4.2.3 lib/spree/api/responders/rabl_template.rb
spree_api-4.2.2 lib/spree/api/responders/rabl_template.rb
spree_api-4.2.1 lib/spree/api/responders/rabl_template.rb
spree_api-4.0.7 lib/spree/api/responders/rabl_template.rb
spree_api-3.7.14 lib/spree/api/responders/rabl_template.rb
spree_api-4.2.0 lib/spree/api/responders/rabl_template.rb
spree_api-4.2.0.rc5 lib/spree/api/responders/rabl_template.rb
spree_api-4.2.0.rc4 lib/spree/api/responders/rabl_template.rb
spree_api-4.2.0.rc3 lib/spree/api/responders/rabl_template.rb
spree_api-4.1.13 lib/spree/api/responders/rabl_template.rb
spree_api-4.0.6 lib/spree/api/responders/rabl_template.rb
spree_api-4.2.0.rc2 lib/spree/api/responders/rabl_template.rb
spree_api-3.7.13 lib/spree/api/responders/rabl_template.rb
spree_api-4.0.5 lib/spree/api/responders/rabl_template.rb
spree_api-4.1.12 lib/spree/api/responders/rabl_template.rb
spree_api-3.7.12 lib/spree/api/responders/rabl_template.rb
spree_api-4.2.0.rc1 lib/spree/api/responders/rabl_template.rb