<< | Index | >>
Now (z.B.)
Goal (z.B.)
Note
Experiment
STRING = [ ... :migel_limitation, ...
def migel_search if migel_code = @session.user_input(:migel_code) and product = @session.search_migel_products(migel_code).first ODDB::State::Migel::Items.new(@session, ODDB::Migel::Items.new(product)) elsif migel_code = @session.user_input(:migel_product) and product = @session.search_migel_products(migel_code).first ODDB::State::Migel::Product.new(@session, product) elsif migel_code = @session.user_input(:migel_subgroup) and subgroup = @session.app.search_migel_subgroup(migel_code) ODDB::State::Migel::Subgroup.new(@session, subgroup) elsif migel_code = @session.user_input(:migel_group) and group = @session.app.search_migel_group(migel_code) ODDB::State::Migel::Group.new(@session, group)elsif migel_code = @session.user_input(:migel_limitation) and limitation_text = @session.app.search_migel_limitation(migel_code)
ODDB::State::Migel::LimitationText.new(@session, limitation_text)
else self end end
def search_migel_limitation(migel_code) case migel_code.length when 2 # Group if group = MIGEL_SERVER.group.find_by_migel_code(migel_code) group.limitation_text end when 4 # Subgroup code = migel_code.split(/(\d\d)/).select{|x| !x.empty?}.join('.') if subgroup = MIGEL_SERVER.subgroup.find_by_migel_code(code) subgroup.limitation_text end when 9 # Product (Migel::Model::Migelid) z.B. 150101001 code = migel_code.split(/(\d\d)/).select{|x| !x.empty?}.join('.') if migelid = MIGEL_SERVER.migelid.find_by_migel_code(code) migelid.limitation_text end end end
Access
Result
NoMethodError undefined method `parent' for #<Migel::Util::Multilingual:0x7f1de01701d8> /home/masa/ywesee/oddb.org/src/remote/multilingual.rb:29:in `method_missing' /home/masa/ywesee/oddb.org/src/view/migel/limitationtext.rb:39:in `limitation_text_title' /usr/lib64/ruby/site_ruby/1.8/htmlgrid/composite.rb:66:in `send' /usr/lib64/ruby/site_ruby/1.8/htmlgrid/composite.rb:66:in `create' /usr/lib64/ruby/site_ruby/1.8/htmlgrid/composite.rb:280:in `compose_component' /usr/lib64/ruby/site_ruby/1.8/htmlgrid/composite.rb:209:in `compose' /usr/lib64/ruby/site_ruby/1.8/htmlgrid/composite.rb:203:in `each' /usr/lib64/ruby/site_ruby/1.8/htmlgrid/composite.rb:203:in `compose' /usr/lib64/ruby/site_ruby/1.8/htmlgrid/composite.rb:55:in `init' /usr/lib64/ruby/site_ruby/1.8/htmlgrid/component.rb:138:in `initialize' /home/masa/ywesee/oddb.org/src/view/publictemplate.rb:53:in `new' /home/masa/ywesee/oddb.org/src/view/publictemplate.rb:53:in `content' /usr/lib64/ruby/site_ruby/1.8/htmlgrid/composite.rb:66:in `send' /usr/lib64/ruby/site_ruby/1.8/htmlgrid/composite.rb:66:in `create' /usr/lib64/ruby/site_ruby/1.8/htmlgrid/composite.rb:280:in `compose_component' /usr/lib64/ruby/site_ruby/1.8/htmlgrid/composite.rb:209:in `compose' /usr/lib64/ruby/site_ruby/1.8/htmlgrid/composite.rb:203:in `each' /usr/lib64/ruby/site_ruby/1.8/htmlgrid/composite.rb:203:in `compose' /usr/lib64/ruby/site_ruby/1.8/htmlgrid/composite.rb:55:in `init' /home/masa/ywesee/oddb.org/src/view/publictemplate.rb:50:in `init' /home/masa/ywesee/oddb.org/src/view/privatetemplate.rb:16:in `init' /usr/lib64/ruby/site_ruby/1.8/htmlgrid/component.rb:138:in `initialize' /usr/lib64/ruby/site_ruby/1.8/sbsm/state.rb:285:in `new' /usr/lib64/ruby/site_ruby/1.8/sbsm/state.rb:285:in `view' /usr/lib64/ruby/site_ruby/1.8/sbsm/state.rb:197:in `to_html' /usr/lib64/ruby/site_ruby/1.8/sbsm/session.rb:529:in `to_html' /usr/lib64/ruby/site_ruby/1.8/sbsm/session.rb:177:in `drb_process' /usr/lib64/ruby/site_ruby/1.8/sbsm/session.rb:174:in `synchronize' /usr/lib64/ruby/site_ruby/1.8/sbsm/session.rb:174:in `drb_process' /usr/lib64/ruby/1.8/drb/drb.rb:1555:in `__send__' /usr/lib64/ruby/1.8/drb/drb.rb:1555:in `perform_without_block' /usr/lib64/ruby/1.8/drb/drb.rb:1515:in `perform' /usr/lib64/ruby/1.8/drb/drb.rb:1589:in `main_loop' /usr/lib64/ruby/1.8/drb/drb.rb:1585:in `loop' /usr/lib64/ruby/1.8/drb/drb.rb:1585:in `main_loop' /usr/lib64/ruby/1.8/drb/drb.rb:1581:in `start' /usr/lib64/ruby/1.8/drb/drb.rb:1581:in `main_loop' /usr/lib64/ruby/1.8/drb/drb.rb:1430:in `run' /usr/lib64/ruby/1.8/drb/drb.rb:1427:in `start' /usr/lib64/ruby/1.8/drb/drb.rb:1427:in `run' /usr/lib64/ruby/1.8/drb/drb.rb:1347:in `initialize' /usr/lib64/ruby/1.8/drb/drb.rb:1627:in `new' /usr/lib64/ruby/1.8/drb/drb.rb:1627:in `start_service' bin/oddbd:38
Note
Question
Solution
def parent=(parent) # This is used when Migel::Importer updates the limitaion_text @parent = parent end def parent(arg) # This is used when limitation_text is shown in ODDB::View::LimitationText @parent end
def parent=(parent) # This is used when Migel::Importer updates the limitaion_text @parent = parent end def parent(arg) # This is used when limitation_text is shown in ODDB::View::LimitationText @parent end
.. group.limitation_text.send(language.to_s + '=', text) unless(text.empty?) group.limitation_text.parent = group .. subgroup.limitation_text.send(language.to_s + '=', text) subgroup.limitation_text.parent = subgroup ..
def update_multilingual(data, language) data.keys.each do |key| self.send(key).send(language.to_s + '=', data[key]) end if @limitation_text @limitation_text.parent = self end end
Restore database
masa@masa ~/ywesee/migel $ sudo -u postgres dropdb migel masa@masa ~/ywesee/migel $ sudo -u postgres createdb -E UTF8 -T template0 migel masa@masa ~/ywesee/migel $ bin/migeld
migel> Migel::Importer.new.update('data/csv/migel_de_test.csv','de') -> Array
Access
Result
error in SBSM::Session#http_headers: /de/gcc/migel_search/migel_limitation/150101001 NoMethodError undefined method `parent' for #<DRb::DRbUnknown:0x7f6c50ca3208> /home/masa/ywesee/oddb.org/src/view/migel/limitationtext.rb:39:in `limitation_text_title' /usr/lib64/ruby/site_ruby/1.8/htmlgrid/composite.rb:66:in `send' /usr/lib64/ruby/site_ruby/1.8/htmlgrid/composite.rb:66:in `create' /usr/lib64/ruby/site_ruby/1.8/htmlgrid/composite.rb:280:in `compose_component' /usr/lib64/ruby/site_ruby/1.8/htmlgrid/composite.rb:209:in `compose'
class Multilingual include DRb::DRbUndumped
Access
Result
Note
Question
Problem
class Multilingual include DRb::DRbUndumped
Note
Experiment
migel> Migel::Model::Migelid.find_by_migel_code('15.01.01.00.1').limitation_text -> Limitation: Nur bei durch Krankheit oder Unfall bedingter Inkontinenz wie z. B. Multipler Sklerose, Querschnittlähmung, cerebraler Lähmung, Morbus Parkinson, Demenz. migel> Migel::Model::Migelid.find_by_migel_code('15.01.01.00.1').limitation_text.de -> Limitation: Nur bei durch Krankheit oder Unfall bedingter Inkontinenz wie z. B. Multipler Sklerose, Querschnittlähmung, cerebraler Lähmung, Morbus Parkinson, Demenz.
ch.oddb> search_migel_limitation('150101001').class -> DRb::DRbObject ch.oddb> search_migel_limitation('150101001').de -> Limitation: Nur bei durch Krankheit oder Unfall bedingter Inkontinenz wie z. B. Multipler Sklerose, Querschnittlähmung, cerebraler Lähmung, Morbus Parkinson, Demenz. ch.oddb> search_migel_limitation('150101001') -> Limitation: Nur bei durch Krankheit oder Unfall bedingter Inkontinenz wie z. B. Multipler Sklerose, Querschnittlähmung, cerebraler Lähmung, Morbus Parkinson, Demenz.
Note
module ODDB module View module Migel class LimitationTextInnerComposite < View::Drugs::LimitationTextInnerComposite DEFAULT_CLASS = HtmlGrid::Value def subgroup(model, session) product = model.parent(@session.app) if(lim = product.subgroup.limitation_text) lim.send(@session.language) end end def group(model, session) product = model.parent(@session.app) if(lim = product.group.limitation_text) lim.send(@session.language) end end end
module ODDB module View module Drugs class LimitationTextInnerComposite < HtmlGrid::Composite COMPONENTS = {} DEFAULT_CLASS = View::Chapter def init yy = 0 lang = @session.language.intern if(@model.respond_to?(lang) && @model.send(lang)) components.store([0,yy], lang) yy += 1 end super end end
Note
Key point
Note
Experiment
def de @canonical[:de] end
def de @canonical[:de] end
Access
Point
class LimitationTextInnerComposite < HtmlGrid::Composite def init yy = 0 lang = @session.language.intern if(@model.respond_to?(lang) && @model.send(lang)) components.store([0,yy], lang) yy += 1 end
Even if it works by using method_missing method, the respond_to? method does not return 'true'
Result
def parent(app = nil) @subgroup end
def parent(app = nil) @group end
def parent(app = nil) nil end
# For PointerSteps (snapback links) def pointer_descr 'Limitation' end def structural_ancestors(app) #[@parent.subgroup.group, @parent.subgroup, @parent] ancestors = [] me = self while parent = me.parent ancestors.unshift parent me = parent end ancestors end
# For PointerSteps (snapback links) def pointer_descr 'Limitation' end def structural_ancestors(app) #[@parent.subgroup.group, @parent.subgroup, @parent] ancestors = [] me = self while parent = me.parent ancestors.unshift parent me = parent end ancestors end
class LimitationText < View::PrivateTemplate CONTENT = View::Migel::LimitationTextComposite SNAPBACK_EVENT = :result def backtracking(model, session=@session) ODDB::View::Migel::PointerSteps.new(model, @session, self) end end
Access
Result
Problem
Console log
/home/masa/.gem/ruby/1.8/gems/gd2-1.1.1/lib/gd2/font.rb:234: [BUG] Segmentation fault ruby 1.8.6 (2009-06-08) [x86_64-linux] Abgebrochen
Note
Ruby/GD test
References
Note