RailsCasts Pro episodes are now free!

Learn more or hide this

Stephen Paul Suarez's Profile

GitHub User: devpopol

Site: http://www.stephenpaul.me

Comments by Stephen Paul Suarez

Avatar

for a quick&dirty support on jsonp with this, you can go with an after_filter:

ruby
after_filter do |controller| 
    if controller.params[:callback] && controller.params[:format].to_s == 'json'
      controller.response['Content-Type'] = 'application/javascript'
      controller.response.body = "%s(%s)" % [controller.params[:callback], controller.response.body]
    end
  end
Avatar

from the last time i've seen it, RABL is good with objects that are ActiveModel compliant. doesn't provide a lot of support if for example you have an Array/Hash object that you got from redis that needs to be represented as json.