Created
March 16, 2009 14:05
-
-
Save miketierney/79892 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Event < ActiveRecord::Base | |
belongs_to :group | |
belongs_to :location | |
validates_presence_of :group_id, :location_id, :start_time, :end_time | |
define_index do | |
indexes name | |
end | |
end | |
class Group < ActiveRecord::Base | |
has_many :events | |
has_many :locations, :through => :events | |
validates_presence_of :name | |
define_index do | |
indexes name | |
indexes events.description, :as => :event_descriptions | |
indexes [locations.name, locations.address], :as => :location_addresses | |
end | |
end | |
class Location < ActiveRecord::Base | |
acts_as_mappable :auto_geocode => true, :lat_column_name => 'latitude', :lng_column_name => 'longitude' | |
has_many :events | |
has_many :groups, :through => :events | |
validates_presence_of :name, :address | |
define_index do | |
indexes name, :sortable => true | |
indexes address, :sortable => true | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment