Skip to content

Commit

Permalink
Fix N+1 for looping challenge
Browse files Browse the repository at this point in the history
  • Loading branch information
Sam Goldstein committed Apr 17, 2013
1 parent b20c470 commit 667968f
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 11 deletions.
2 changes: 1 addition & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ gem 'nokogiri'
gem 'httparty'
gem 'dalli'

gem 'newrelic_rpm', '>=3.5'
gem 'newrelic_rpm', '>=3.6'
gem "pg", ">= 0.14.1"

group :production do
Expand Down
4 changes: 2 additions & 2 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ GEM
mime-types (1.21)
multi_json (1.6.1)
multi_xml (0.5.3)
newrelic_rpm (3.5.7.59)
newrelic_rpm (3.6.0.78)
nokogiri (1.5.6)
pg (0.14.1)
polyglot (0.3.3)
Expand Down Expand Up @@ -120,7 +120,7 @@ DEPENDENCIES
dalli
httparty
jquery-rails
newrelic_rpm (>= 3.5)
newrelic_rpm (>= 3.6)
nokogiri
pg (>= 0.14.1)
rails (= 3.2.12)
Expand Down
2 changes: 1 addition & 1 deletion app/controllers/loop_controller.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
class LoopController < ApplicationController
def index
@sites = WebSite.limit(1000)
@sites = WebSite.includes(:icon).limit(1000)
end
end
13 changes: 11 additions & 2 deletions config/database.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,17 @@ development:
encoding: unicode
database: newrelic-ruby-kata_development
pool: 5
username: <%= ENV['USER'] %>
password:
username: postgres
password: demo
template: template0
production:
adapter: postgresql
host: localhost
encoding: unicode
database: newrelic-ruby-kata_development
pool: 5
username: postgres
password: demo
template: template0

# Connect on a TCP socket. Omitted by default since the client uses a
Expand Down
2 changes: 1 addition & 1 deletion config/environments/production.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
config.action_controller.perform_caching = true

# Disable Rails's static asset server (Apache or nginx will already do this)
config.serve_static_assets = false
config.serve_static_assets = true

# Compress JavaScripts and CSS
config.assets.compress = true
Expand Down
8 changes: 4 additions & 4 deletions config/newrelic.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ common: &default_settings
# You must specify the license key associated with your New Relic
# account. This key binds your Agent's data to your account in the
# New Relic service.
license_key: '<%= ENV["NEW_RELIC_LICENSE_KEY"] %>'
license_key: 'bb2daacefc44283a2dcb3f233491f43c783aa8d1'

# Agent Enabled (Rails Only)
# Use this setting to force the agent to run or not run.
Expand All @@ -32,7 +32,7 @@ common: &default_settings
# - Ajax Service
# - All Services
#
app_name: <%= ENV["NEW_RELIC_APP_NAME"] %>
app_name: Ruby Code Kata

# When "true", the agent collects performance data about your
# application and reports this data to the New Relic service at
Expand Down Expand Up @@ -220,7 +220,7 @@ development:
# 'enabled').
# NOTE: for initial evaluation purposes, you may want to temporarily
# turn the agent on in development mode.
monitor_mode: false
monitor_mode: true

# Rails Only - when running in Developer Mode, the New Relic Agent will
# present performance information on the last 100 transactions you have
Expand Down Expand Up @@ -252,4 +252,4 @@ production:
staging:
<<: *default_settings
monitor_mode: true
app_name: <%= ENV["NEW_RELIC_APP_NAME"] %> (Staging)
app_name: <%= ENV["NEW_RELIC_APP_NAME"] %> (Staging)

0 comments on commit 667968f

Please sign in to comment.