Advertisement
vedranvinko

helper

Jul 15th, 2015
373
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 0.20 KB | None | 0 0
  1. def json_or_jsonp( json )
  2.   callback = params.delete('callback')
  3.  
  4.   if callback
  5.     content_type :js
  6.     response = "#{callback}(#{json})"
  7.   else
  8.     content_type :json
  9.     response = json
  10.   end
  11. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement