Sha256: c753b75ded77fac3c0d3e6e12cec1f993a7ce50b2ebd8e87d11b012ff155fd8e
Contents?: true
Size: 930 Bytes
Versions: 4
Compression:
Stored size: 930 Bytes
Contents
class Address include Mongoid::Document attr_accessor :mode field :address_type field :number, :type => Integer field :street field :city field :state field :post_code field :parent_title field :services, :type => Array field :latlng, :type => Array key :street embeds_many :locations embedded_in :addressable, :inverse_of => :addresses do def extension "Testing" end def doctor? title == "Dr" end end named_scope :rodeo, where(:street => "Rodeo Dr") do def mansion? all? { |address| address.street == "Rodeo Dr" } end end validates_presence_of :street, :on => :update def set_parent=(set = false) self.parent_title = addressable.title if set end class << self def california where(:state => "CA") end def homes where(:address_type => "Home") end def streets all.map(&:street) end end end
Version data entries
4 entries across 4 versions & 1 rubygems