Skip to content

Instantly share code, notes, and snippets.

@mguterl
Created February 18, 2010 01:31
Show Gist options
  • Save mguterl/307229 to your computer and use it in GitHub Desktop.
Save mguterl/307229 to your computer and use it in GitHub Desktop.
class Location
include Mongoid::Document
field :location
field :country
field :state
field :city
field :zip_code
field :lat, :type => Float
field :lng, :type => Float
belongs_to :locatable, :inverse_of => :locations
end
class User
include Mongoid::Document
# snip typical user fields
has_one :location
has_one :ideal_location, :class_name => "Location"
has_one :birthplace, :class_name => "Location"
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment