Created
August 8, 2010 03:03
Revisions
-
jcoene revised this gist
Aug 8, 2010 . 1 changed file with 5 additions and 13 deletions.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -11,8 +11,10 @@ class RapSupahStah field :mode field :value after_initialize :my_after_initialize_callback def my_after_initialize_callback puts "after_initialize" puts "Using Mongoid: #{Mongoid::VERSION}" self.mode ||= "balla" @@ -28,14 +30,4 @@ def initialize(attributes={}) end mongo_money = RapSupahStah.new puts mongo_money.mode -
rdetert created this gist
Aug 8, 2010 .There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,41 @@ 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 ################