class ApplicationController < ActionController::Base def with_json(json) if @request.xhr? @headers['Content-Type'] = 'text/javascript; charset=utf-8' render_text json.to_json else yield end end end
…という機能はやっぱり既にあるのかなぁ。見つけられない。
class ApplicationController < ActionController::Base def with_json(json) if @request.xhr? @headers['Content-Type'] = 'text/javascript; charset=utf-8' render_text json.to_json else yield end end end
…という機能はやっぱり既にあるのかなぁ。見つけられない。