projects
/
selectricity
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
df110d7
)
fixed and re-enabled support for memcache in the production site
author
Benjamin Mako Hill
<mako@ephesus.xvm.mit.edu>
Sun, 17 Jun 2012 22:42:57 +0000
(18:42 -0400)
committer
Benjamin Mako Hill
<mako@ephesus.xvm.mit.edu>
Sun, 17 Jun 2012 22:42:57 +0000
(18:42 -0400)
app/controllers/quickvote_controller.rb
patch
|
blob
|
history
config/environments/development.rb
patch
|
blob
|
history
config/environments/production.rb
patch
|
blob
|
history
config/environments/test.rb
patch
|
blob
|
history
diff --git
a/app/controllers/quickvote_controller.rb
b/app/controllers/quickvote_controller.rb
index c32d585dd53cc441d8e36d7a72fe74be9edaec90..b57abaa40dfba69ab01d3912023e183bda8af771 100644
(file)
--- a/
app/controllers/quickvote_controller.rb
+++ b/
app/controllers/quickvote_controller.rb
@@
-161,7
+161,7
@@
class QuickvoteController < ApplicationController
else
# record the ip address for posterity
else
# record the ip address for posterity
- @voter.ipaddress = request.env["
REMOTE_ADD
R"]
+ @voter.ipaddress = request.env["
HTTP_X_FORWARDED_FO
R"]
@voter.save
# toggle the confirmation bit
@voter.save
# toggle the confirmation bit
@@
-186,9
+186,10
@@
class QuickvoteController < ApplicationController
@election=QuickVote.ident_to_quickvote(params[:id])
@election.voters.each do |voter|
next unless voter.ipaddress
@election=QuickVote.ident_to_quickvote(params[:id])
@election.voters.each do |voter|
next unless voter.ipaddress
+
location=nil
location=nil
- if
defined?
Cache and location=Cache.get("GEO:#{voter.ipaddress}")
- elsif
defined?
Cache
+ if Cache and location=Cache.get("GEO:#{voter.ipaddress}")
+ elsif Cache
location = GeoKit::Geocoders::IpGeocoder.geocode(voter.ipaddress)
Cache.set "GEO:#{voter.ipaddress}", location
else
location = GeoKit::Geocoders::IpGeocoder.geocode(voter.ipaddress)
Cache.set "GEO:#{voter.ipaddress}", location
else
diff --git
a/config/environments/development.rb
b/config/environments/development.rb
index 2d7f9789e0a4bf8cb1e9388defc71e218665520f..669f755c2473357389d4e4b82779d98e5e912c56 100644
(file)
--- a/
config/environments/development.rb
+++ b/
config/environments/development.rb
@@
-1,6
+1,7
@@
# Settings specified here will take precedence over those in config/environment.rb
#disable memcache
Cache=nil
# Settings specified here will take precedence over those in config/environment.rb
#disable memcache
Cache=nil
+
# In the development environment your application's code is reloaded on
# every request. This slows down response time but is perfect for development
# since you don't have to restart the webserver when you make code changes.
# In the development environment your application's code is reloaded on
# every request. This slows down response time but is perfect for development
# since you don't have to restart the webserver when you make code changes.
diff --git
a/config/environments/production.rb
b/config/environments/production.rb
index 20ded00559a49d05e95a180342e910687db7bcfd..4bb13510ef6ff610417fb7dd61803e5795e8eee1 100644
(file)
--- a/
config/environments/production.rb
+++ b/
config/environments/production.rb
@@
-1,9
+1,9
@@
# Settings specified here will take precedence over those in config/environment.rb
#
#Enable memcache
# Settings specified here will take precedence over those in config/environment.rb
#
#Enable memcache
-
#
require('memcache')
-
#
Cache=MemCache.new('localhost', :compression => true)
-Cache=nil
+require('memcache')
+Cache=MemCache.new('localhost', :compression => true)
+
# The production environment is meant for finished, "live" apps.
# Code is not reloaded between requests
config.cache_classes = true
# The production environment is meant for finished, "live" apps.
# Code is not reloaded between requests
config.cache_classes = true
diff --git
a/config/environments/test.rb
b/config/environments/test.rb
index a1a2608bbfd3ef55531c08d37403266a0d7d463f..f1ab738a22a3a4c59c118b6aca242243cd81312f 100644
(file)
--- a/
config/environments/test.rb
+++ b/
config/environments/test.rb
@@
-1,6
+1,7
@@
# Settings specified here will take precedence over those in config/environment.rb
#disable memcache
Cache=nil
# Settings specified here will take precedence over those in config/environment.rb
#disable memcache
Cache=nil
+
# The test environment is used exclusively to run your application's
# test suite. You never need to work with it otherwise. Remember that
# your test database is "scratch space" for the test suite and is wiped
# The test environment is used exclusively to run your application's
# test suite. You never need to work with it otherwise. Remember that
# your test database is "scratch space" for the test suite and is wiped
Benjamin Mako Hill
||
Want to submit a patch?