안녕하세요 내가 사용 그래프를 만드는 방법에 대한 책을 읽은 한 구글 - 차트 - 레일에, 난 이미 플러그인을 설치하지만, 나에게이 오류 보여줍니다 이유는 모르겠어요 :구글 - 차트 -에 - 레일
NameError in TankingLogsController#index
uninitialized constant TankingLogsController::GoogleChart
을
이 내 컨트롤러 내 indes.html.erb 여기
<div class="container">
<%= image_tag @bar %>
<h1>Listing Tankings</h1>
<% if @tankinglog.count<1 %>
<p>
There are no tankings for this car. Do you want to <%= link_to 'create a new tanking', new_user_car_tanking_log_path(@user, @car)%>
</p>
<% else %>
<table class="table table-condensed">
<tr>
<th>Cost</th>
<th>Gallon</th>
<th>Km</th>
<th>Date</th>
<th>Gas Station's id</th>
<th></th>
</tr>
<% @tankinglog.each do |tankinglog| %>
<tr>
<td><%= tankinglog.cost %></td>
<td><%= tankinglog.gallon %></td>
<td><%= tankinglog.km %></td>
<td><%= tankinglog.date %></td>
<td><%= tankinglog.gas_station_id %></td>
</tr>
<% end %>
</table>
<br />
<%= link_to 'New tanking', new_user_car_tanking_log_path(@user, @car), :class => "btn btn-primary" %>
<% end %>
<br />
<br />
<%= link_to 'back', user_cars_path(current_user), :class => "btn btn-primary" %>
</div>
입니다
class TankingLogsController < ApplicationController
....
def index
@user = User.find(params[:user_id])
@car = @user.cars.find(params[:car_id])
@tankinglog = @car.tanking_logs.all
@bar = GoogleChart.pie(['1997',10],['1998',20],['1999',40],['2000',30]).to_url
end
end
내 Gemfile
,source 'https://rubygems.org'
gem 'rails', '3.2.6'
gem 'pg', '0.13.2'
gem 'devise', '2.0.4'
gem 'haml-rails'
gem 'twitter-bootstrap-rails', '2.0.6'
gem 'sass-rails', '~> 3.2.3'
gem "rspec", "~> 2.10.0"
gem 'simplecov', :require => false, :group => :test
gem 'gchart'
나는이 줄을 내 Gemfile에 넣었고 다음과 같은 오류가 발생했습니다.이 컴퓨터에서 사용할 수있는 보석에서 'google-charts-on-rails (> = 0) ruby'를 찾을 수 없습니다. – Asantoya17
나의 나쁜 - 나는 이것이 당신이 사용하고있는 보석이라고 생각했는데 - 이것은 작동하지 않을 것이다 ... 어쨌든 비슷한 기능을 제공하는 보석을 사용하는 것을 권할 것이다. 어쩌면 googlecharts : [http : // googlecharts.rubyforge.org/] –
나는 [http://googlecharts.rubyforge.org/]의 단계를 밟았지만 오류를 제외하고는 변화가 없었다 : ActionView :: CompiledTemplates :: Gchart – Asantoya17