[Nitro] Concerns over Og mandating the form of initialize

James Britt james_b at neurogami.com
Thu Apr 14 13:13:54 EDT 2005


George Moschovitis wrote:
>>What value would create_date return after og_read?
> 
> 
> Here is the workflow:
> 
> f = Foo.new
> f.tstamp # => Time.now 
> 
> # now lets save this:
> 
> f.save
> 
> # => INSERT INTO og_foo (..., tstamp, ...) VALUES (..., TimeStampAsSql, ...)

Why is tstamp being saved?

Here's a variation:

class Foo
   attr_accessor  :x, :y
   def initialize( x=nil, y=nil )
      @x = x
      @y = y
      @tstamp = Time.new
   end

   def is_too_old?
      t = Time.now
      ( t.to_i - @tstamp.to_i > 1000000 )
   end

end

How can @tstamp be saved or set?


I believe, then, that under Og, this must become something like:

   def initialize( x=nil, y=nil )
      @x = x
      @y = y
      post_og_read
   end

   def post_og_read
      @tstamp = Time.new
      # maybe also validate values of @x and @y
   end

James



More information about the Nitro-general mailing list