Prev | Current Page 376 | Next

David Berube

"Practical Reporting with Ruby and Rails"

rb
create test/functional/budget_optimizer_controller_test.rb
create app/helpers/budget_optimizer_helper.rb
Finally, create the single model:
ruby script/generate model ad_results
CHAPTER 13 n TRACKING YOUR ADS WITH GOOGLE ADWORDS 272
exists app/models/
exists test/unit/
exists test/fixtures/
create app/models/ad_results.rb
create test/unit/ad_results_test.rb
create test/fixtures/ad_results.yml
create db/migrate
create db/migrate/001_create_ad_results.rb
Note that at this point, you??™ll need to edit your config/database.yml file to reflect your
database connection parameters.
Put the code in Listing 13-3 in your single controller.
Listing 13-3. Budget Optimizer Controller (app/controllers/budget_optimizer_controller.rb)
class BudgetOptimizerController < ApplicationController
def index
end
def report
@excel_view = params[:view_as_excel]
@target_clicks=params[:target_clicks].to_f
results_raw=AdResult.find(:all,
:select=>'headline,
AVG(cost) as cost,
AVG(clicks) as clicks',
:group=>'headline')
results_raw.


Pages:
364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388
świnoujście noclegi Hotele SPA Jastrzębia Góra Zmniejszanie zdjęć alergolog kraków Zamykanie naczynek kraków