Skip to content

Instantly share code, notes, and snippets.

View krishna-shilpakar's full-sized avatar

krishna shilpakar krishna-shilpakar

View GitHub Profile
@krishna-shilpakar
krishna-shilpakar / inherit_include.rb
Created May 24, 2011 08:05
Model inheritance or include
# Structure for inheritance
# app/models/parent/base.rb
class Parent::Base
include Mongoid::Document
end
# app/models/parent/first_child.rb
class FirstChild < Parent::Base
# fields needed for first child
@krishna-shilpakar
krishna-shilpakar / gist:724847
Created December 2, 2010 05:59
example_model
class Person
include Mongoid::Document
field :name, :type => String
field :age, :type => Integer
field :address, :type => Hash
end
/***** ADDING THROUGH CONSOLE ******/