Sha256: 15cb3835fb2d072f12708338cdbff5ba7181a621e6f2170642d9f5334ed3649c
Contents?: true
Size: 1.33 KB
Versions: 4
Compression:
Stored size: 1.33 KB
Contents
class User < Chimera::Base use_config :default # this is implied even if not here attribute :name attribute :age attribute :occupation attribute :interests attribute :home_coordinate # [37.2,122.1] attribute :ssn attribute :updated_at attribute :favorite_car, :model, :class => :car # User.find_with_index(:home_coordinate, {:coordinate => [37.2,122.1], :steps => 5}) index :home_coordinate, :type => :geo, :step_size => 0.05 # User.find_with_index(:occupation, { :q => "developer", :type => :intersect } ) # fuzzy search. :intersect or :union index :occupation, :type => :search # User.find_with_index(:ssn, "12345") # exact search, enforces unique constraint index :ssn, :type => :unique # User.find_with_index(:name, "Ben") # like :search but exact index :name, :type => :find association :friends, :user association :cars, :car redis_object :num_logins, :counter validates_presence_of :name end class Car < Chimera::Base attribute :color attribute :make attribute :model attribute :year attribute :mileage attribute :comments attribute :sku attribute :curr_location index :year, :type => :find index :comments, :type => :search index :sku, :type => :unique index :curr_location, :type => :geo, :step_size => 0.05 validates_presence_of :make, :model, :year end
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
chimera-0.0.4 | test/models.rb |
chimera-0.0.3 | test/models.rb |
chimera-0.0.2 | test/models.rb |
chimera-0.0.1 | test/models.rb |