view · edit · sidebar · attach · print · history

20120629-create-sequence-tailbarkeit

<< | Index | >>


Summary

  • Created Divison (for Teilbarkeit of Sequence) Model class
    • updated Sequence
    • added Admin Form of Sequence
    • created same Object refecence.

Commits

Index


Create Divison class

ODDB::Divison class include SequenceObserver

ch.oddb> Divison.new.sequences
-> []
ch.oddb> sequences.values.first.division.nil?
-> true

Sequence Model

I created updation/creation by pointer.
Sequence model has to have following methods.

create_division
    def create_division
      div = Division.new
      div.add_sequence self
      @division = div 
      div 
    end
division=
    def division=(division)
      super(division)
      @division = replace_observer(@division, division)
    end

And doesn't have to implement.

divison
  def division
    @division || Division.new
  end

Assign same Object

Sequences can pointer to same Division Object. (like patinfo,fachinfo)

ch.oddb> registration('31706').sequence('02').division
-> #<ODDB::Division:0x0000000d5cf028>
ch.oddb> registration('31706').sequence('02').division.odba_id
-> 28770673
ch.oddb> registration('31706').sequence('01').division.odba_id
-> 28770673
view · edit · sidebar · attach · print · history
Page last modified on June 29, 2012, at 01:08 PM