[Nitro] [ANN] Nitro + Og 0.22.0

George Moschovitis george.moschovitis at gmail.com
Tue Aug 9 16:16:18 EDT 2005


seems nice, I 'll add something like this :) Thanks.
-g.

> i got something, that works for me:
> 
> entity.rb:
> 
>    def set_sequence(seq)
>       meta :sequence, seq
>     end
> 
> 
> store/psql:
> 
>   def enchant(klass, manager)
>     if klass.metadata.sequence
>       klass.const_set 'OGSEQ', klass.metadata.sequence.to_s
>     else
>         if sclass = klass.metadata.superclass
>           klass.const_set 'OGSEQ', "#{table(sclass.first)}_oid_seq"
>         else
>             klass.const_set 'OGSEQ', "#{table(klass)}_oid_seq"
>         end
>     end
> 
>     if klass.metadata.primary_key.flatten.first == :oid
>       unless klass.properties.find { |p| p.symbol == :oid }
>         klass.property :oid, Fixnum, :sql => 'serial PRIMARY KEY'
>       end
>     end
>     super
>   end

-- 
http://www.gmosx.com
http://www.nitrohq.com
http://www.joy.gr




More information about the Nitro-general mailing list