ankane/chartkick

Allow overiding `chart_json` on ActiveRecord

bekicot opened this issue · 1 comments

Is your feature request related to a problem? Please describe.
Consider this class:

class HourlyForecast < ApplicationRecord
  def self.chart_json
    ..
  end
end


p HourlyForecast.where.method(:chart_json).source_location
## Currently
# ["/---/chartkick-4.0.5/lib/chartkick/enumerable.rb", 4]
## Expected
# ["app/models/hourly_forecast, 2]

Something like that.

Hey @bekicot, thanks for reporting, and sorry for the delay. I've updated chart_json to be defined on Array and Hash instead of Enumerable, which fixes this. It'll be part of the Chartkick 5 release.