Ticket #9833: render_json_docfix.diff
| File render_json_docfix.diff, 2.3 kB (added by chuyeow, 9 months ago) |
|---|
-
actionpack/lib/action_controller/base.rb
old new 748 748 # 749 749 # === Rendering JSON 750 750 # 751 # Rendering JSON sets the content type to text/x-json and optionally wraps the JSON in a callback. It is expected752 # that the response will be eval'dfor use as a data structure.751 # Rendering JSON sets the content type to application/json and optionally wraps the JSON in a callback. It is expected 752 # that the response will be parsed (or eval'd) for use as a data structure. 753 753 # 754 # # Renders '{ name: "David"}'754 # # Renders '{"name": "David"}' 755 755 # render :json => {:name => "David"}.to_json 756 756 # 757 # It's not necessary to call <tt>to_json</tt> on the object you want to render, since <tt>render</tt> will 758 # automatically do that for you: 759 # 760 # # Also renders '{"name": "David"}' 761 # render :json => {:name => "David"} 762 # 757 763 # Sometimes the result isn't handled directly by a script (such as when the request comes from a SCRIPT tag), 758 # so the callbackoption is provided for these cases.764 # so the <tt>:callback</tt> option is provided for these cases. 759 765 # 760 # # Renders 'show({ name: "David"})'766 # # Renders 'show({"name": "David"})' 761 767 # render :json => {:name => "David"}.to_json, :callback => 'show' 762 768 # 763 769 # === Rendering an inline template -
actionpack/lib/action_controller/mime_type.rb
old new 52 52 EXTENSION_LOOKUP[extension] 53 53 end 54 54 55 # Registers an alias that's not us d on mime type lookup, but can be referenced directly. Especially useful for55 # Registers an alias that's not used on mime type lookup, but can be referenced directly. Especially useful for 56 56 # rendering different HTML versions depending on the user agent, like an iPhone. 57 57 def register_alias(string, symbol, extension_synonyms = []) 58 58 register(string, symbol, [], extension_synonyms, true)