## 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