user938363
user938363

Reputation: 10350

Rails 4: chart is not showing

chartkick is integrated into a Rails 4 app. In gemfile, there added:

gem 'chartkick'
gem 'highcharts'
gem 'groupdate'

A simple action common_chart is defined as:

def common_chart
  @data_set = PaymentRequest.all
end

Here is common_chart.html.erb:

<div class="container-fluid">

    <% line_chart @data_set.group('request_date').count, discrete: true %> 
</div>

A link is embeded on main page as:

<%= link_to 'PR Dashboard Report', common_chart_payment_requests_path(), class: BUTTONS_CLS['block-info'] %>

However when clicking PR Dashboard Report, there is nothing showing on the screen. No chart at all.

Upvotes: 0

Views: 275

Answers (1)

Roman Kiselenko
Roman Kiselenko

Reputation: 44360

Change:

<% line_chart @data_set.group('request_date').count, discrete: true %> 

To:

<%= line_chart @data_set.group('request_date').count, discrete: true %> 

<% %> shows nothing, <%= %> shows output.

Upvotes: 2

Related Questions