Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Caching front-page. Added GetClickly code.

  • Loading branch information...
commit 433f82fc2fea708e08b7c547a7d85b9b15166912 1 parent d529bbf
Paul M. Watson paulmwatson authored
4 app/controllers/cities_controller.rb
View
@@ -1,5 +1,7 @@
class CitiesController < ApplicationController
layout 'base'
+
+ caches_page :index
def index
@cities = City.find :all, :order => 'country, name', :conditions => {:hidden => false}
@@ -33,6 +35,8 @@ def check
def create
@city = City.find(:first, :conditions => {:name => params[:city][:name]}) || City.new(params[:city])
+
+ expire_page :controller => '/', :action => :index
if @city.save
flash[:notice] = 'City was successfully created.'
34 app/views/layouts/base.html.erb
View
@@ -25,19 +25,25 @@
<a href="<%= @photo.url %>"><%= @photo.title %></a> by <%= @photo.photographer %>
</div>
</div>
- <script type="text/javascript">
- var not_iphone = navigator.userAgent.indexOf('iPhone') <= 0;
- if (not_iphone)
- {
- $('body').addClass('not_iphone');
- }
- var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
- document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
- </script>
- <script type="text/javascript">
- try {
- var pageTracker = _gat._getTracker("UA-265441-9");
- pageTracker._trackPageview();
- } catch(err) {}</script>
+ <%- if RAILS_ENV == "production" -%>
+ <script type="text/javascript">
+ var not_iphone = navigator.userAgent.indexOf('iPhone') <= 0;
+ if (not_iphone)
+ {
+ $('body').addClass('not_iphone');
+ }
+ var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
+ document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
+ </script>
+ <script type="text/javascript">
+ try {
+ var pageTracker = _gat._getTracker("UA-265441-9");
+ pageTracker._trackPageview();
+ } catch(err) {}</script>
+
+ <a title="Clicky Web Analytics" href="http://getclicky.com/81343"><img alt="Clicky Web Analytics" src="http://static.getclicky.com/media/links/badge.gif" border="0" /></a>
+ <script src="http://static.getclicky.com/81343.js" type="text/javascript"></script>
+ <noscript><p><img alt="Clicky" width="1" height="1" src="http://static.getclicky.com/81343-db10.gif" /></p></noscript>
+ <%- end -%>
</body>
</html>
2  config/deploy.rb
View
@@ -1,7 +1,7 @@
set :user, 'deploy'
set :application, "sickcity.org"
set :scm, :git
-set :repository, "git@github.com:paulmwatson/sickcity.git"
+set :repository, "git://github.com/paulmwatson/sickcity.git"
after "deploy:update_code", "deploy:symlink_configs"
# If you aren't deploying to /u/apps/#{application} on the target
2  config/environments/development.rb
View
@@ -11,7 +11,7 @@
# Show full error reports and disable caching
config.action_controller.consider_all_requests_local = true
config.action_view.debug_rjs = true
-config.action_controller.perform_caching = false
+config.action_controller.perform_caching = true
# Don't care if the mailer can't send
config.action_mailer.raise_delivery_errors = false
Please sign in to comment.
Something went wrong with that request. Please try again.