Skip to content

Instantly share code, notes, and snippets.

View Empact's full-sized avatar

Benjamin Woosley Empact

View GitHub Profile
@Empact
Empact / has_counter_cache_on.rb
Created June 14, 2011 10:22
has_counter_cache_on is a simple ActiveRecord extension which allows you to have multiple counters for a single association, counted when simple conditions are met
# has_counter_cache_on is a simple ActiveRecord extension
# which allows you to have multiple counters for a single
# association, counted when simple conditions are met
#
# The implementation is adapted from the current
# add_counter_cache_callbacks code in Rails.
#
# Example:
#
# class Submission < ActiveRecord::Base
# Filename: RAILS_ROOT/lib/paperclip_processors/thumbnail_with_dimensions.rb
# Required Configuration in the model
# has_attached_file :image,
# :styles => {
# :thumbnail => {
# :geometry => "100x100>",
# :format => :png,
# :processors => [:thumbnail_with_dimensions],
# :mystyle => :thumbnail
# },
@Empact
Empact / load_spec.rb
Created October 17, 2009 14:41 — forked from yob/gist:212242
[~/Projects/OpenSource/roxml (master)⚡] $ ruby spec/load_spec.rb
/opt/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require': no such file to load -- roxml (LoadError)
from /opt/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `require'
from spec/load_spec.rb:2
[~/Projects/OpenSource/roxml (master)⚡] $ sudo gem install pkg/roxml-3.1.0.gem
Password:
Successfully installed roxml-3.1.0
1 gem installed
Installing ri documentation for roxml-3.1.0...
Installing RDoc documentation for roxml-3.1.0...