Sha256: 6b0ec5c3a6a2c7d40b8df5a54fc7d227f7533a4807c80ff7e109f126e2c501c2

Contents?: true

Size: 608 Bytes

Versions: 2

Compression:

Stored size: 608 Bytes

Contents

# frozen_string_literal: true

module Railsful
  module Serializable
    def render(options = nil, extra_options = {}, &block)

      # In case we see regular page-render requests like:
      #
      #   render :index, layout: true
      #
      # we just pass them through without modification to Rails.
      if options.is_a?(Symbol) || extra_options.key?(:layout)
        return super(*[options, extra_options], &block)
      end

      super(fast_jsonapi_options(options), extra_options, &block)
    end

    def fast_jsonapi_options(options)
      Serializer.new(self).render(options)
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
railsful-0.3.0 lib/railsful/serializable.rb
railsful-0.2.0 lib/railsful/serializable.rb