Sha256: 19a5405af5dba9540a05d85d7c47d8637cc71f78634ae17c9fd5870c60884343

Contents?: true

Size: 569 Bytes

Versions: 13

Compression:

Stored size: 569 Bytes

Contents

module ActsAsApi
  # Contains rails specific renderers used by acts_as_api to render a jsonp response
  #
  # See ActsAsApi::Config about the possible configurations
  module RailsRenderer

    def self.setup
      ActionController.add_renderer :acts_as_api_jsonp do |json, options|
        json = ActiveSupport::JSON.encode(json) unless json.respond_to?(:to_str)
        json = "#{options[:callback]}(#{json}, #{response.status})" unless options[:callback].blank?
        self.content_type ||= Mime::JSON
        self.response_body = json
      end
    end

  end
end

Version data entries

13 entries across 13 versions & 2 rubygems

Version Path
acts_as_api_sequel-0.0.1 lib/acts_as_api/rails_renderer.rb
acts_as_api-0.4.2 lib/acts_as_api/rails_renderer.rb
acts_as_api-0.4.1 lib/acts_as_api/rails_renderer.rb
acts_as_api-0.4 lib/acts_as_api/rails_renderer.rb
acts_as_api-0.3.11 lib/acts_as_api/rails_renderer.rb
acts_as_api-0.3.10 lib/acts_as_api/rails_renderer.rb
acts_as_api-0.3.9 lib/acts_as_api/rails_renderer.rb
acts_as_api-0.3.8 lib/acts_as_api/rails_renderer.rb
acts_as_api-0.3.7 lib/acts_as_api/rails_renderer.rb
acts_as_api-0.3.6 lib/acts_as_api/rails_renderer.rb
acts_as_api-0.3.5 lib/acts_as_api/rails_renderer.rb
acts_as_api-0.3.4 lib/acts_as_api/rails_renderer.rb
acts_as_api-0.3.3 lib/acts_as_api/rails_renderer.rb