Created
August 8, 2010 03:03
-
-
Save jcoene/513522 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'rubygems' | |
puts ENV["GEM_HOME"] | |
require 'mongoid' | |
require 'mongoid/version' | |
class RapSupahStah | |
include Mongoid::Document | |
cache | |
attr_accessor :mode | |
field :mode | |
field :value | |
def after_initialize | |
puts "after_initialize" | |
puts "Using Mongoid: #{Mongoid::VERSION}" | |
self.mode ||= "balla" | |
end | |
def initialize(attributes={}) | |
puts "initialize" | |
puts "Using Mongoid: #{Mongoid::VERSION}" | |
super | |
self.mode ||= "pimp" | |
end | |
end | |
mongo_money = RapSupahStah.new | |
puts mongo_money.mode | |
################ | |
# Output: | |
################ | |
# $ ruby after_initialize_test.rb | |
# /Users/ryan/.rvm/gems/ruby-1.8.7-p299 | |
# initialize | |
# Using Mongoid: 2.0.0.beta.16 | |
# pimp | |
################ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment