vedranvinko icon

helper

vedranvinko | PRO | 07/15/15 06:07:30 PM UTC | 0 ⭐ | 822 👁️ | Never ⏰ | []
Ruby |

200 B

|

None

|

0 👍

/

0 👎

def json_or_jsonp( json )
  callback = params.delete('callback')
 
  if callback
    content_type :js
    response = "#{callback}(#{json})"
  else
    content_type :json
    response = json
  end
end

Comments