class Sequel::Model

  1. lib/sequel/model.rb
  2. lib/sequel/model/associations.rb
  3. lib/sequel/model/base.rb
  4. lib/sequel/model/dataset_module.rb
  5. lib/sequel/model/errors.rb
  6. show all
Superclass: Object

Sequel::Model is an object relational mapper built on top of Sequel core. Each model class is backed by a dataset instance, and many dataset methods can be called directly on the class. Model datasets return rows as model instances, which are wrappers around the underlying hash that allow easily updating or deleting the individual row.

Sequel::Model is built completely out of plugins. Plugins can override any class, instance, or dataset method defined by a previous plugin and call super to get the default behavior. By default, Sequel::Model loads two plugins, Sequel::Model (which is itself a plugin) for the base support, and Sequel::Model::Associations for the associations support.

You can set the SEQUEL_NO_ASSOCIATIONS constant or environment variable to make Sequel not load the associations plugin by default.

Constants

HOOKS = [ :after_create, :after_destroy, :after_save, :after_update, :after_validation, :before_create, :before_destroy, :before_save, :before_update, :before_validation ].freeze  

Empty instance methods to create that the user can override. Just like any other method defined by Sequel, if you override one of these, you should call super to get the default behavior (while empty by default, they are often overridden by plugins). See the “Model Hooks” guide for more detail on hooks.

OPTS = Sequel::OPTS  
RESTRICTED_SETTER_METHODS = instance_methods.map(&:to_s).select{|l| l.end_with?('=')}.freeze  

The setter methods (methods ending with =) that are never allowed to be called automatically via set/update/new/etc.