Browse files

Adds support for accessing view_helpers inside rabl templates

  • Loading branch information...
1 parent 481460c commit 34110c54dfb74f8061be6924531f3dffdf001e86 @nesquena nesquena committed May 18, 2011
Showing with 5 additions and 0 deletions.
  1. +5 −0 lib/rabl/engine.rb
View
5 lib/rabl/engine.rb
@@ -148,5 +148,10 @@ def format_json(json_output)
use_callback = Rabl.configuration.enable_json_callbacks && request_params[:callback].present?
use_callback ? "#{request_params[:callback]}(#{json_output})" : json_output
end
+
+ # Supports calling helpers defined for the template scope using method_missing hook
+ def method_missing(name, *args, &block)
+ @_scope.respond_to?(name) ? @_scope.send(name, *args, &block) : super
+ end
end
end

0 comments on commit 34110c5

Please sign in to comment.