Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save jeremyevans/3868477 to your computer and use it in GitHub Desktop.
Save jeremyevans/3868477 to your computer and use it in GitHub Desktop.
Trying to use a sequel model without a table
# in sequel/plugins/foo.rb
module Sequel::Plugin::Foo
def self.apply(model)
model.plugin :timestamps, :create => :created_on, :update => :updated_on
model.plugin :validation_helpers
model.many_to_one :user
end
module InstanceMethods
# Note that it's probably a bad idea to override initialize unless you
# really know what you are doing.
def initialize(params={}) ... end
# Make sure to call super inside these methods.
def before_save ... end
def after_create ... end
def validate ... end
end
end
class Bar1 < Sequel::Model(:bar1)
plugin :foo
...
end
class Bar2 < Sequel::Model(:bar2)
plugin :foo
...
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment