rabl-rails/lib/rabl-rails.rb
ccocchi 8a49001b0f Do not fail when JSON engine is not found
and fallback to default
2012-07-26 16:44:51 +02:00

42 lines
801 B
Ruby

require 'rails/railtie'
require 'active_support'
require 'active_support/core_ext/class/attribute_accessors'
require 'rabl-rails/version'
require 'rabl-rails/template'
require 'rabl-rails/compiler'
require 'rabl-rails/renderer'
require 'rabl-rails/library'
require 'rabl-rails/handler'
require 'rabl-rails/railtie'
require 'multi_json'
module RablRails
extend Renderer
mattr_accessor :cache_templates
@@cache_templates = true
mattr_accessor :include_json_root
@@include_json_root = true
mattr_accessor :json_engine
@@json_engine = :yajl
def self.configure
yield self
end
def self.cache_templates?
ActionController::Base.perform_caching && @@cache_templates
end
def self.set_conversion_engines!
MultiJson.use(self.json_engine) rescue nil
end
end