lib/whereabouts_methods.rb
def has_whereabouts klass=:address, *args
      options = args.extract_options!
      # extend Address with class name if not defined.
      unless klass == :address || Object.const_defined?(klass.to_s.camelize)
        create_address_class(klass.to_s.camelize)
      end

      # Set the has_one relationship and accepts_nested_attributes_for.  
      has_one klass, :as => :addressable, :dependent => :destroy
      accepts_nested_attributes_for klass

      # Define a singleton on the class that returns an array
      # that includes the address fields to validate presence of 
      # or an empty array
      if options[:validate] && options[:validate].is_a?(Array)
        validators = options[:validate]
        set_validators(klass, validators)
      else
        validators = []
      end
      define_singleton_method validate_singleton_for(klass) do validators end

      # Check for geocode in options and confirm geocoder is defined.
      # Also defines a singleton to return a boolean about geocoding.
      if options[:geocode] && options[:geocode] == true && defined?(Geocoder)
        geocode = true
        set_geocoding(klass)
      else
        geocode = false
      end
      define_singleton_method geocode_singleton_for(klass) do geocode end
    end
def has_whereabouts klass=:address, *args
      options = args.extract_options!
      # extend Address with class name if not defined.
      unless klass == :address || Object.const_defined?(klass.to_s.camelize)
        create_address_class(klass.to_s.camelize)
      end

      # Set the has_one relationship and accepts_nested_attributes_for.  
      has_one klass, :as => :addressable, :dependent => :destroy
      accepts_nested_attributes_for klass

      # Define a singleton on the class that returns an array
      # that includes the address fields to validate presence of 
      # or an empty array
      if options[:validate] && options[:validate].is_a?(Array)
        validators = options[:validate]
        set_validators(klass, validators)
      else
        validators = []
      end
      define_singleton_method validate_singleton_for(klass) do validators end

      # Check for geocode in options and confirm geocoder is defined.
      # Also defines a singleton to return a boolean about geocoding.
      if options[:geocode] && options[:geocode] == true && defined?(Geocoder)
        geocode = true
        set_geocoding(klass)
      else
        geocode = false
      end
      define_singleton_method geocode_singleton_for(klass) do geocode end
    end
Accepts a symbol that will define the inherited
 type of Address.  Defaults to the parent class.