Do not fail when JSON engine is not found

and fallback to default
This commit is contained in:
ccocchi 2012-07-26 16:44:51 +02:00
parent 6e5fc9c833
commit 8a49001b0f
3 changed files with 5 additions and 5 deletions

View File

@ -2,6 +2,7 @@
## 0.1.2 (unreleased)
* Add RablRails#render method (see README or source code)
* Fix fail when JSON engine is not found. Now fallback to MultiJson.default_adapter
## 0.1.1

View File

@ -29,15 +29,13 @@ module RablRails
def self.configure
yield self
post_configure
end
def self.cache_templates?
ActionController::Base.perform_caching && @@cache_templates
end
private
def self.post_configure
MultiJson.engine = self.json_engine
def self.set_conversion_engines!
MultiJson.use(self.json_engine) rescue nil
end
end

View File

@ -3,6 +3,7 @@ module RablRails
initializer "rabl.initialize" do |app|
ActiveSupport.on_load(:action_view) do
ActionView::Template.register_template_handler :rabl, RablRails::Handlers::Rabl
RablRails.set_conversion_engines!
end
end
end