class RenderJsonTest::TestController

Public Class Methods

controller_path() click to toggle source
# File actionpack/test/controller/render_json_test.rb, line 24
def self.controller_path
  "test"
end

Public Instance Methods

render_json_hello_world() click to toggle source
# File actionpack/test/controller/render_json_test.rb, line 36
def render_json_hello_world
  render json: ActiveSupport::JSON.encode(hello: "world")
end
render_json_hello_world_with_callback() click to toggle source
# File actionpack/test/controller/render_json_test.rb, line 44
def render_json_hello_world_with_callback
  render json: ActiveSupport::JSON.encode(hello: "world"), callback: "alert"
end
render_json_hello_world_with_status() click to toggle source
# File actionpack/test/controller/render_json_test.rb, line 40
def render_json_hello_world_with_status
  render json: ActiveSupport::JSON.encode(hello: "world"), status: 401
end
render_json_nil() click to toggle source
# File actionpack/test/controller/render_json_test.rb, line 28
def render_json_nil
  render json: nil
end
render_json_render_to_string() click to toggle source
# File actionpack/test/controller/render_json_test.rb, line 32
def render_json_render_to_string
  render plain: render_to_string(json: "[]")
end
render_json_with_custom_content_type() click to toggle source
# File actionpack/test/controller/render_json_test.rb, line 48
def render_json_with_custom_content_type
  render json: ActiveSupport::JSON.encode(hello: "world"), content_type: "text/javascript"
end
render_json_with_extra_options() click to toggle source
# File actionpack/test/controller/render_json_test.rb, line 60
def render_json_with_extra_options
  render json: JsonRenderable.new, except: [:c, :e]
end
render_json_with_render_to_string() click to toggle source
# File actionpack/test/controller/render_json_test.rb, line 56
def render_json_with_render_to_string
  render json: { hello: render_to_string(partial: "partial") }
end
render_json_without_options() click to toggle source
# File actionpack/test/controller/render_json_test.rb, line 64
def render_json_without_options
  render json: JsonRenderable.new
end
render_symbol_json() click to toggle source
# File actionpack/test/controller/render_json_test.rb, line 52
def render_symbol_json
  render json: ActiveSupport::JSON.encode(hello: "world")
end