Sequel::Model Plugins for v4.4.0
Sequel::Model has a standardized and very flexible plugin architecture, see the RDoc. Here is a list of plugins that members of the Sequel community have developed:
Plugins that ship with Sequel
- Associations:
- association_dependencies: Allows easy deleting, destroying, or nullifying associated objects when destroying a model object.
- association_pks: Adds the association_pks and association_pks= to *_to_many associations.
- association_proxies: Changes the *_to_many association method to return a proxy instead of an array of objects.
- dataset_associations: Adds association methods to datasets that return datasets of associated objects.
- eager_each: Makes each on an eagerly loaded dataset do eager loading.
- many_through_many: Allows you to create an association to multiple objects through multiple join tables.
- nested_attributes: Allows you to modified associated objects directly through a model object, similar to ActiveRecord's Nested Attributes.
- pg_array_associations: Adds associations types to handle the case where foreign keys are stored in a PostgreSQL array in one of the tables.
- rcte_tree: Supports retrieving all ancestors and descendants for tree structured data using recursive common table expressions.
- tactical_eager_loading: Allows you to eagerly load an association for all objects retreived from the same dataset when calling the association method on any of the objects in the dataset.
- tree: Allows you to treat model objects as being part of a tree, finding ancestors, descendants, siblings, and tree roots.
- Attributes:
- blacklist_security: Adds blacklist-based model mass-assignment protection.
- boolean_readers: Adds attribute? methods for all boolean columns.
- dirty: Allows you get get initial values of columns after changing the values.
- defaults_setter: Get default values for new models before saving.
- force_encoding: Forces the all model column string values to a given encoding.
- input_transformer: Automatically transform input to model column setters.
- lazy_attributes: Allows you to set some attributes that should not be loaded by default, but only loaded when an object requests them.
- string_stripper: Strips strings assigned to model attributes.
- Caching:
- caching: Supports caching primary key lookups of model objects to any object that supports the Ruby-Memcache API.
- static_cache: Caches all model instances, improving performance for static models.
- Hooks:
- after_initialize: Adds an after_initialize hook to model objects, called for both new objects and those loaded from the database.
- hook_class_methods: Adds backwards compatiblity for the legacy class-level hook methods (e.g. before_save :do_something).
- instance_hooks: Allows you to add hooks to specific model instances.
- Inheritance:
- class_table_inheritance: Supports inheritance in the database by using a single database table for each class in a class hierarchy.
- single_table_inheritance: Supports inheritance in the database by using a single table for all classes in a class hierarchy.
- Prepared Statements:
- prepared_statements: Makes models use prepared statements for deletes, inserts, updates, and lookups by primary key.
- prepared_statements_associations: Makes models use prepared statements for regular loading of associations.
- prepared_statements_safe: Makes use of prepared_statements plugin more safe by setting explicit defaults for model columns when inserting and saving whole rows instead of changed columns.
- prepared_statements_with_pk: Makes model datasets's #with_pk method use prepared statements.
- Saving:
- instance_filters: Allows you to add per instance filters that are used when updating or destroying the instance.
- mssql_optimistic_locking: Uses a timestamp/rowversion column on Microsoft SQL Server to prevent concurrent updates overwriting changes.
- optimistic_locking: Adds a database-independent locking mechanism to models to prevent concurrent updates overwriting changes.
- sharding: Additional model support for Sequel's sharding support.
- skip_create_refresh: Allows you to skip the refresh when saving new model objects.
- timestamps: Creates hooks for automatically setting create and update timestamps.
- touch: Allows easily updating timestamps via Model#touch, as well as touching associations when model instances are updated or destroyed.
- unlimited_update: Works around MySQL warnings when using replication due to LIMIT clause use when updating model instances.
- update_primary_key: Allows you to safely update the primary key of a model object.
- Serialization:
- composition: Supports defining getters/setters for objects with data backed by the model's columns.
- json_serializer: Allows you to serialize/deserialize model objects to/from JSON.
- serialization: Supports serializing column values and storing them as either marshal, yaml, or json in the database.
- serialization_modification_detection: Allows you to detect changes to serialized columns.
- xml_serializer: Allows you to serialize/deserialize model objects to/from XML.
- Validations:
- auto_validations: Automatically add presence, not_string, and unique validations.
- constraint_validations: Setup automatic validations for constraints added via the constraint_validations extension.
- error_splitter: Splits multi-column errors entries into separate errors, one per column.
- validation_class_methods: Adds backwards compatibility for the legacy class-level validation methods (e.g. validates_presence_of :column).
- validation_helpers: The preferred default validations plugin, which uses instance-level methods.
- Other:
- active_model: Makes Sequel::Model objects compliant to the ActiveModel::Lint specs, so they should work correctly in Rails 3+.
- list: Allows you to treat model objects as being part of a list, so you can move them up/down and get next/previous entries.
- pg_row: Allows Sequel::Model classes to implement PostgreSQL row-valued/composite types.
- pg_typecast_on_load: Handles typecasting of PostgreSQL array/hstore/composite types when loading model objects via jdbc, do, or swift adapters.
- schema: Adds backwards compatibility for Model.set_schema and Model.create_table.
- scissors: Adds class methods for delete, destroy, and update.
- subclasses: Allows easy access all model subclasses and descendent classes, without using ObjectSpace.
- table_select: Selects table.* instead of just * for model datasets.
- typecast_on_load: Fixes bad database typecasting when loading model objects.
External Plugins
- forme: HTML forms library for ruby that integrates with Sequel::Model for easy form creation.
- sequel_bulk_attributes: Provides bulk assignment functionality for one_to_many associations.
- sequel-bit_fields: Allows treating an integer column as a bitfield of many boolean settings.
- sequel_container: Contained documents (i.e. attachments) for models.
- sequel_crushyform: Builds forms for you
- sequel_mappable: Provides geocoding functionality to model & dataset.
- sequel_nested_set: Nested set implementation, ported from the Awesome Nested Set Active Record plugin.
- sequel_notnaughty: Port of the NotNaughty validation framework.
- sequel_paperclip: Provides attachment functionality for models, including post processing (thumbnail generation, etc).
- sequel_polymorphic: Lets you easily create polymorphic associations.
- sequel_proc_error_handling: Lets you add procs that automatically rescue and fix model errors.
- sequel_secure_password: Adds bcrypt authentication and password hashing to models.
- sequel_sexy_validations: Provides sexy validations (like those in rails 3) for models.
- sequel_simple_callbacks: Enables ActiveRecord-compatible class-level before and after filter declarations for models with support for conditional execution.
- sequel_sluggable: Easy slug behaviour for any model.
- sequel_taggable: Allows easily adding tags to any model.
- sequel_validation_helpers_block: Allows easy determination of which validation rules apply to a given column, at the expense of increased verbosity.
Sequel Extensions
Extensions are modifications or additions to Sequel that affect either Sequel::Database objects (database extensions), Sequel::Dataset objects (dataset extensions), or the general ruby environment (global extensions).
Database extensions that ship with Sequel
Database extensions can be loaded into a single Sequel::Database object via Sequel::Database#extension, or to all databases by using Sequel::Database.extension.
- arbitrary_servers: Adds ability to connection to arbitrary servers (instead of just preconfigured ones) in the sharding support.
- connection_validator: Automatically validates connections on pool checkout and handles disconnections transparently.
- constraint_validations: Creates database constraints when creating/altering tables, with metadata for automatic model validations via the constraint_validations plugin.
- error_sql: Makes DatabaseError#sql return the SQL query that caused the underlying exception.
- from_block: Makes blocks passed to Database#from affect FROM clause instead of WHERE clause.
- looser_typecasting: Uses .to_f and .to_i instead of Kernel.Float and Kernel.Integer when typecasting floats and integers.
- pg_array: Adds support for PostgreSQL arrays.
- pg_hstore: Adds support for the PostgreSQL hstore type.
- pg_inet: Adds support for the PostgreSQL inet and cidr types.
- pg_interval: Adds support for the PostgreSQL interval type.
- pg_json: Adds support for the PostgreSQL json type.
- pg_loose_count: Adds Database#loose_count for fast approximate counts of whole tables on PostgreSQL.
- pg_range: Adds support for PostgreSQL range types.
- pg_row: Adds support for PostgreSQL row-valued/composite types.
- pg_static_cache_updater: Listens for changes to underlying tables in order to automatically update models using the static_cache plugin.
- schema_caching: Speeds up loading a large number of models by caching database schema and loading it from a file.
- schema_dumper: Adds Database#dump_schema_migration and related methods for dumping the schema of the database as a migration that can be restored on other databases.
- server_block: Adds Database#with_server method that makes access inside the passed block use the specified shard by default.
Dataset extensions that ship with Sequel
Dataset extensions can be loaded into a single Sequel::Database object via Sequel::Dataset#extension, or to all datasets for a given database via Sequel::Database.extension, or all datasets for all databases by using Sequel::Database.extension.
- columns_introspection: Attemps to skip database queries by introspecting the selected columns if possible.
- date_arithmetic: Allows for database-independent date calculations (adding/subtracting an interval to/from a date/timestamp).
- empty_array_ignore_nulls: Makes Sequel's handling of IN/NOT IN with an empty ignore correct NULL handling.
- filter_having: Makes Dataset#filter, #and, #or, and #having operate on HAVING clause if HAVING clause is already present.
- graph_each: Makes Dataset#each split returned results by table when using Dataset#graph.
- hash_aliases: Makes Dataset#select and #from treat hashes and alias specifications.
- null_dataset: Adds Dataset#nullify to get a dataset that will never issue a query.
- mssql_emulate_lateral_with_apply: Emulates LATERAL queries using CROSS/OUTER APPLY on Microsoft SQL Server.
- pagination: Adds Dataset#paginate for easier pagination of datasets.
- pretty_table: Adds Dataset#print for printing a dataset as a simple plain-text table.
- query: Adds Dataset#query for a different interface to creating queries that doesn't use method chaining.
- query_literals: Automatically uses literal strings for regular strings in select, group, and order methods (similar to filter methods).
- select_remove: Adds Dataset#select_remove to remove selected columns from a dataset.
- sequel_3_dataset_methods: Adds Dataset#[]=, #insert_multiple, #qualify_to, #qualify_to_first_source, #set, #to_csv, #db=, and #opts= methods.
- set_overrides: Adds Dataset#set_defaults and #set_overrides for setting default values in some INSERT/UPDATE statements.
- split_array_nil: Splits nils out of IN/NOT IN arrays into separate OR IS NULL or AND IS NOT NULL clauses.
- to_dot: Adds Dataset#to_dot method, which returns a string suitable for processing by graphviz's dot program to get a visualization of the dataset's abstract syntax tree.
Global extensions that ship with Sequel
Global extensions can affect other parts of Sequel or the general ruby environment, and are loaded with Sequel.extension.
- blank: Adds blank? instance methods to all objects.
- core_extensions: Extends the Array, Hash, String, and Symbol classes with methods that return Sequel expression objects.
- core_refinements: Adds refinement versions of Sequel's core extensions.
- eval_inspect: Makes inspect on Sequel's expression objects attempt to return a string suitable for eval.
- inflector: Adds instance-level inflection methods to String.
- meta_def: Adds meta_def method for defining methods to Database, Dataset, and Model classes and instances.
- migration: Adds Migration and Migrator classes for easily migrating the database schema forward or reverting to a previous version.
- named_timezones: Allows you to use named timezones instead of just :local and :utc (requires TZInfo).
- pg_array_ops: Adds DSL support for calling PostgreSQL array operators and functions.
- pg_hstore_ops: Adds DSL support for calling PostgreSQL hstore operators and functions.
- pg_json_ops: Adds DSL support for calling PostgreSQL json operators and functions.
- pg_range_ops: Adds DSL support for calling PostgreSQL range operators and functions.
- pg_row_ops: Adds DSL support for dealing with PostgreSQL row-valued/composite types.
- ruby18_symbol_extensions: Contains implementations of Symbol#{<,<=,>,>=,[]} that are only usable on ruby 1.8.
- sql_expr: Adds sql_expr method to all objects, allowing easy use of Sequel's DSL.
- string_date_time: Adds instance methods to String for converting the string into a Date/Time/DateTime.
- thread_local_timezones: Allows for per-thread overrides of the global timezone settings.
External Extensions
- fixture_dependencies: YAML fixture loader that handles dependencies/associated objects, respecting foreign key constraints.
- i18n_backend_sequel: Allows Sequel to be a backend for i18n translations.
- merb_sequel: Merb plugin that provides support for Sequel models.
- rails_sequel: Rails 2 plugin that allows you to use Sequel instead of ActiveRecord.
- rspec_sequel_matchers: RSpec matchers for Sequel validations, associations, and columns.
- sequel_extjs: Generates JSON from datasets that is consumable by the ExtJS JsonStore.
- sequel-location: Easy setup and syntax for doing geolocation search on PostgreSQL.
- sequel_pg: Faster SELECTs when using Sequel with pg.
- sequel_plus: Collection of sequel extensions.
- sequel_postgresql_triggers: Database enforced timestamps, immutable columns, and counter/sum caches.
- sequel-rails: Rails 3 plugin that allows you to use Sequel instead of ActiveRecord.
- sequel_rails3: Another Rails 3 plugin that allows you to use Sequel instead of ActiveRecord.
- sequel_vectorized: Allows Sequel::Dataset to be exported as an Hash of Arrays and NArrays.
Submitting Your Plugin/Extension
If you have created a Sequel plugin/extension and would like to list it here, please submit a request to code AT jeremyevans DOT net, or send a pull request via github.