Skip to content

Commit

Permalink
support JSON-P callback parameter
Browse files Browse the repository at this point in the history
  • Loading branch information
davidhq committed Dec 20, 2009
1 parent 089d31d commit ac6e926
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions lib/asbestos.rb
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -30,8 +30,14 @@ def #{compiled_name}
end end


render :text => @template.with_template(template) { render :text => @template.with_template(template) {
@template.send(:_evaluate_assigns_and_ivars) @template.send(:_evaluate_assigns_and_ivars)
@template.send(compiled_name) result = @template.send(compiled_name)
# support JSON-P
if callback = options[:callback]
"#{callback}(#{result})"
else
result
end
} }
end end
end end
Expand Down

0 comments on commit ac6e926

Please sign in to comment.