Forum: Ruby on Rails Strange problem with Gruff not always displaying graph

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
12a8d751a8453cf1ef391bc8fa3a3a7b?d=identicon&s=25 Gimzo (Guest)
on 2006-06-05 05:48

I am having a strange problem with Gruff not always displaying the graph
on the page. On some pages, the graph is displayed fine. On others,
however, I just get the number relating to the id of the requested item
- in my case, report.

Does anyone know how to solve this problem?

I have the following in my controller:

def create_graph

     g =
     g.title = "Reports"

     g.theme = {
       :colors => ['#CC0000', '#00CC00', '#cc6633', '#cc9966',
       :marker_color => 'black',
       :background_colors => ['#FAFAFA', '#FAFAFA']

      report_number = []
      labels = []

     @report = User.find(session[:user]).reports.find(params[:id])
     @records = @report.report_items.find(:all, :conditions => [
"report_context = 'Required'" ] )

      for report_items in @records
        report_number << report_item.amount.to_i
    labels <<
      end"Reports", report_number)
      g.labels = labels

    :disposition => 'inline',
    :type => 'image/png',
    :filename => "report_img.png")


Then, in the view, I have the following:

<%= image_tag url_for(:controller => 'reports', :action =>
'create_graph', :id => @report) %>

Why would the image appear for some of the report pages and not the

Any help on this would be great.

8d89c3087cc6cb98793ab7c0f5658c56?d=identicon&s=25 Gimzo (Guest)
on 2006-06-08 04:50
Problem sorted, thanks
This topic is locked and can not be replied to.