airblade/chartjs-ror

Options variable mutability

Closed this issue · 0 comments

In this part
https://github.com/airblade/chartjs-ror/blob/master/lib/chartjs/chart_helpers.rb#L31
the code deletes hash elements from original options hash, making it unusable in further code. The workaround now is to passing the duplicate of options to chart helper:

bar_chart @chart_data, @chart_options.dup

Obviously it is not nice to modify input arguments without any warning.