Permalink
Browse files

Merge pull request #173 from gregorym/cache_projects

Added a little bit of caching
  • Loading branch information...
2 parents 6624439 + d332cb9 commit 65aeee3223611e82488f0d3ff8af8bc3361322fe @andrew andrew committed Dec 9, 2012
View
@@ -70,3 +70,7 @@ group :test do
gem 'webmock', :require => false
gem 'poltergeist'
end
+
+group :production do
+ gem 'dalli'
+end
View
@@ -60,6 +60,7 @@ GEM
commonjs (0.2.6)
crack (0.3.1)
daemons (1.1.9)
+ dalli (2.1.0)
database_cleaner (0.9.1)
diff-lcs (1.1.3)
ejs (1.1.1)
@@ -332,6 +333,7 @@ DEPENDENCIES
capybara
chai-jquery-rails
coffee-rails (~> 3.2.1)
+ dalli
database_cleaner
ejs
factory_girl_rails
@@ -4,7 +4,7 @@ class ProjectsController < ApplicationController
respond_to :json, :only => :index
def index
- @projects = Project.order(:name).all
+ @projects = Project.order(:name)
@current_user_languages = logged_in? ? current_user.languages : []
respond_with @projects
end
@@ -1,8 +1,9 @@
-.project{:class => parameterize_language(project.main_language), :data => {:id => project.id}}
- .title.clearfix
- %h4= project.name
- = link_to project.github_repository, project.github_url, :target => '_blank'
- %p
- = truncate project.description, :length => 200
- .language.label.label-info
- = project.main_language
+= cache project do
+ .project{:class => parameterize_language(project.main_language), :data => {:id => project.id}}
+ .title.clearfix
+ %h4= project.name
+ = link_to project.github_repository, project.github_url, :target => '_blank'
+ %p
+ = truncate project.description, :length => 200
+ .language.label.label-info
+ = project.main_language
@@ -7,6 +7,7 @@
# Full error reports are disabled and caching is turned on
config.consider_all_requests_local = false
config.action_controller.perform_caching = true
+ config.cache_store = :dalli_store
# Disable Rails's static asset server (Apache or nginx will already do this)
config.serve_static_assets = false

0 comments on commit 65aeee3

Please sign in to comment.