Permalink
Browse files

Revert Rabl#to_hash, but use Rabls configured parser

  • Loading branch information...
1 parent 453f707 commit 2413e6a4053bbc2d339a2d043247f73bee8f1479 @skade skade committed Jan 11, 2012
Showing with 4 additions and 3 deletions.
  1. +3 −2 lib/gon/sinatra/rabl.rb
  2. +1 −1 spec/gon/gon_spec.rb
View
5 lib/gon/sinatra/rabl.rb
@@ -6,8 +6,9 @@ module Rabl
class << self
def parse_rabl(rabl_path, controller)
source = File.read(rabl_path)
- rabl_engine = ::Rabl::Engine.new(source, :format => 'hash')
- rabl_engine.render(controller, {})
+ rabl_engine = ::Rabl::Engine.new(source, :format => 'json')
+ output = rabl_engine.render(controller, {})
+ ::Rabl.configuration.json_engine.decode(output)
end
end
end
View
2 spec/gon/gon_spec.rb
@@ -65,7 +65,7 @@ def app
it 'render json from rabl template' do
@gon.clear
@objects = [1,2]
- @gon.rabl 'spec/test_data/sample.rabl', :instance => self, :as => 'objects'
+ @gon.rabl 'spec/test_data/sample.rabl', :instance => self
@gon.objects.length.should == 2
end

0 comments on commit 2413e6a

Please sign in to comment.