jpg
+ ./css_graphs/generators/css_graphs/templates/g_colorbar2.jpg
+ ./css_graphs/generators/css_graphs/templates/g_marker.gif
+ ./css_graphs/images/colorbar.jpg
+ ./css_graphs/init.rb
+ ./css_graphs/lib/css_graphs.rb
+ ./css_graphs/test/test_css_graphs.rb
After you install CSS Graphs Helper, you need to copy the files it uses into your
public/images directory:
ruby ./script/generate css_graphs
CHAPTER 11 n TRACKING THE NEWS WITH GOOGLE NEWS 228
create public/images/css_graphs
create public/images/css_graphs/colorbar.jpg
create public/images/css_graphs/g_colorbar.jpg
create public/images/css_graphs/g_colorbar2.jpg
create public/images/css_graphs/g_marker.gif
Now, let??™s start filling in the code for the application. Add the code in Listing 11-3 to
the Reporter controller.
Listing 11-3. Reporter Controller (app/controller/reporter_controller.rb)
class ReporterController < ApplicationController
def index
custom_sql = "SELECT published_at_formatted,
count(*) as count
FROM (SELECT DATE_FORMAT(published_at,
'%m-%d-%y')
AS published_at_formatted
FROM stories) AS grouped_table
GROUP
BY published_at_formatted
;"
@stories = Story.
Pages:
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329