Sha256: 35fb1648bc8d332578b806b99d612a2b08168d38b9e6af7683dd41e29b82d7c7

Contents?: true

Size: 505 Bytes

Versions: 5

Compression:

Stored size: 505 Bytes

Contents

module DeathAndTaxes
  module Taxer
    def self.included(base)
      base.extend ClassMethods
    end
    
    module ClassMethods
      ##
      # Makes this model a taxer
      # It will then be able to create and possess taxes
      # Example:
      #   class State < ActiveRecord::Base
      #     acts_as_taxer
      #   end
      def acts_as_taxer(*args)    
        class_eval do
          has_many :taxes, :as => :taxer, :class_name => "DeathAndTaxes::Tax"
        end
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
death_and_taxes-0.0.5 lib/death_and_taxes/taxer.rb
death_and_taxes-0.0.4 lib/death_and_taxes/taxer.rb
death_and_taxes-0.0.3 lib/death_and_taxes/taxer.rb
death_and_taxes-0.0.2 lib/death_and_taxes/taxer.rb
death_and_taxes-0.0.1 lib/death_and_taxes/taxer.rb