Module: Chartkick::Remote::Responder

Defined in:
lib/chartkick/remote/remote.rb

Instance Method Summary collapse

Instance Method Details

#to_jsonObject


11
12
13
14
15
16
# File 'lib/chartkick/remote/remote.rb', line 11

def to_json
  controller.render_to_string(options.merge(formats: [:html], layout: false))
  data_source = controller.chartkick_remote_blocks[controller.params[:_chartkick_remote_chart_id].to_i].call
  data_source = data_source.chart_json if data_source.respond_to?(:chart_json)
  render json: data_source
end