module HSP
  raise NotImplementedError, "HSP database connection is not defined!" unless 
defined?(::HSP::DB)

  Model = Class.new(Sequel::Model)

  Model.def_Model(self)

  Model.db = ::HSP::DB
  raise 'connection failed!' unless Model.db.test_connection

    # prefer dynamically loaded instead of always pre-loaded
    # HSP::Model.plugin :dataset_associations
end





If I want to use the plugin at later time (hot-plug?), it would give me an 
error

HSP::Model.plugin :dataset_associations

NoMethodError: undefined method `foo' for #<#<Class:0x63648ee9>:0x2ed3b1f5>

The only way I can use the plugin is by always pre-loaded the plugin.


How can I make HSP::Model behave similar to Sequel::Model so that I could 
add plugin dynamically?

thank you.

-- 
You received this message because you are subscribed to the Google Groups 
"sequel-talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sequel-talk/81d7e58c-f4c9-4ef6-b120-a16668004038o%40googlegroups.com.

Reply via email to