Skip to content

Instantly share code, notes, and snippets.

@cousine
Created August 17, 2011 16:05
Show Gist options
  • Save cousine/1151875 to your computer and use it in GitHub Desktop.
Save cousine/1151875 to your computer and use it in GitHub Desktop.
Models structure
class MongoidAlpha
include Mongoid::Document
#include Mongoid::Mebla
field :name
field :value, :type => Integer
field :cost, :type => Float
field :hidden
#self.whiny_indexing = true
belongs_to :mongoid_epsilon
#search_in :name, :cost, :value
end
class MongoidPi
include Mongoid::Document
#include Mongoid::Mebla
field :name
#self.whiny_indexing = true
has_one :mongoid_epsilon, :autosave => true
#search_in :name, :does_smth
def does_smth
"returns smth"
end
end
class MongoidEpsilon
include Mongoid::Document
#include Mongoid::Mebla
field :name
#self.whiny_indexing = true
belongs_to :mongoid_pi
has_many :mongoid_alphas, :autosave => true
#search_in :name, :search_relations => {:mongoid_pi => :name, :mongoid_alphas => [:name, :value]}
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment