Merge pull request #6 from shmeltex/defaultJSONEngine-change

Let MultiJson select default JSON adapter
This commit is contained in:
Christopher Cocchi-Perrier 2012-09-14 14:21:28 -07:00
commit a769f8a3b1
2 changed files with 10 additions and 9 deletions

View File

@ -1,12 +1,13 @@
# CHANGELOG
## 0.2.0 (unrelased)
* Use MultiJson's preferred JSON engine as default
* Default template to render with responder can be set per controller
* Reponder works out of the box with devise
* object or collection can be skipped if use with `respond_to` blocks
## 0.1.3
* Render correcly when variables are not passed via the assigns ivar but as helper methods
* Render correctly when variables are not passed via the assigns ivar but as helper methods
(decent_exposure, focused_controller)
* Add custom Responder
@ -18,7 +19,7 @@
## 0.1.1
* Add CHANGELOG
* Remove unnused test in loop
* Remove unused test in loop
* Speed up rendering by not double copying variable from context
* Rename private variable to avoid name conflict
* Remove sqlite3 development dependency
* Remove sqlite3 development dependency

View File

@ -26,9 +26,6 @@ module RablRails
mattr_accessor :include_json_root
@@include_json_root = true
mattr_reader :json_engine
@@json_engine = :yajl
mattr_accessor :use_custom_responder
@@use_custom_responder = false
@ -43,9 +40,12 @@ module RablRails
def self.json_engine=(name)
MultiJson.engine = name
@@json_engine = name
rescue LoadError
Rails.logger.warn %Q(WARNING: rabl-rails could not load "#{self.json_engine}" as JSON engine, fallback to default)
Rails.logger.warn %Q(WARNING: rabl-rails could not load "#{name}" as JSON engine, fallback to default)
end
def self.json_engine
MultiJson.engine
end
def self.cache_templates?
@ -53,6 +53,6 @@ module RablRails
end
def self.load_default_engines!
self.json_engine = :yajl
self.json_engine = MultiJson.default_engine
end
end