Skip to content

Commit 6fa5bea

Browse files
committed
Now you can send option :controller to gon.rabl
1 parent 33dd91b commit 6fa5bea

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

lib/gon.rb

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,11 @@ def set_variable(name, value)
4444
end
4545

4646
def rabl(view_path, options = {})
47-
rabl_data = Gon::Rabl.parse_rabl(view_path, @request_env['action_controller.instance'])
47+
rabl_data = Gon::Rabl.parse_rabl(view_path, options[:controller] ||
48+
@request_env['action_controller.instance'] ||
49+
@request_env['action_controller.rescue.response'].
50+
instance_variable_get('@template').
51+
instance_variable_get('@controller'))
4852
if options[:as]
4953
set_variable(options[:as].to_s, rabl_data)
5054
elsif rabl_data.is_a? Hash

0 commit comments

Comments
 (0)