Skip to content

Instantly share code, notes, and snippets.

@gotjosh
Created February 22, 2012 17:43
Show Gist options
  • Select an option

  • Save gotjosh/1886264 to your computer and use it in GitHub Desktop.

Select an option

Save gotjosh/1886264 to your computer and use it in GitHub Desktop.
class Property < ActiveRecord::Base
acts_as_indexed :fields => [:title, :rate, :location, :max_occupancy, :bedrooms, :bathrooms, :short_description, :about, :directions, :latitude, :longitude]
attr_accessor :locale
validates :title, :presence => true
has_friendly_id :title, :use_slug => true
translates :title, :location, :short_description, :directions, :amenities, :beds, :entertainment, :kitchen, :outdoor_features, :view_location, :communications, :suitability, :policies, :specifications, :walk_distance, :ten_minutes_driving, :thirty_minutes_driving, :airports
scope :featured, where(:featured => true)
scope :normal, where(:featured => false)
belongs_to :photo_main, :class_name => 'Image'
belongs_to :photo_one, :class_name => 'Image'
belongs_to :photo_two, :class_name => 'Image'
belongs_to :photo_three, :class_name => 'Image'
has_and_belongs_to_many :activities,
:association_foreign_key => "activity_id",
:join_table => "properties_activities"
accepts_nested_attributes_for :activities
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment