Class: ActiveRecord::Base
- Inherits:
-
Object
- Object
- ActiveRecord::Base
- Defined in:
- lib/e9_crm/rails_extensions.rb
Direct Known Subclasses
Campaign, CampaignGroup, Company, Contact, DatedCost, Deal, PageView, TrackingCookie
Class Method Summary collapse
-
.money_columns(*column_names) ⇒ Object
Basic conversion for “money” columns using the Money class and Rails composed_of.
Class Method Details
.money_columns(*column_names) ⇒ Object
Basic conversion for “money” columns using the Money class and Rails composed_of
54 55 56 57 58 59 60 61 62 63 |
# File 'lib/e9_crm/rails_extensions.rb', line 54 def self.money_columns(*column_names) column_names.each do |column_name| class_eval <<-EVAL composed_of :#{column_name}, :class_name => 'Money', :mapping => %w(#{column_name} cents), :converter => Proc.new {|v| v.respond_to?(:to_money) ? v.to_money : v } EVAL end end |