def dataset.some_method(args)
# method here
end
which makes it impossible to do it the _classic_ ruby-module way. Jeremy Eveans (Sequel's creator) enlightened me ;) on the #sequel channel. The Plugin architecture provided by Sequel::Model::is method is the way to do it!
So basically it's
module Sequel::Plugins::Bunchy
module DatasetMethods
# define dataset methods here
end
class ShinyModel < Sequel::Model
is :bunchy
end
You define a module inside Sequel::Plugins scope and inside it define special modules which keep the methods.
- InstanceMethods
- ClassMethods
- DatasetMethods
Names are self-explaining. For some more info go http://sequel.rubyforge.org/classes/Sequel/Plugins.html
Also, after a short chat with Jeremy he told that Sequel is going to have built-in support for separate read and write connections! This means that SELECT will use different DB than INSERT/UPDATE/DELETE. Seems very handy in web apps to lower the DB load on each request. Keep up the good work!
0 comment(s):
Post a Comment