Pastie now auto-senses if line-wrap is a bad or good idea. Feedback?
## mark a section (Learn more)
## config/envrionment.rb config.load_paths += %W(#{RAILS_ROOT}/app/concerns) (in the Rails::Initializer.run section) ## app/concerns/pennies.rb (create the concerns dir) module Pennies def self.included(base) def base.is_pennies(*cols) cols.each do |col| class_eval "def #{col}_in_dollars; self.#{col} / 100; end" end end end end ## app/models/unit.rb (and any other class you want) class Unit < ActiveRecord::Base include Pennies .... is_pennies :monthly_rent_ammount
This paste will be private.
From the Design Piracy series on my blog: