Module: Sequel::Plugins::RailsExtensions

Defined in:
lib/sequel/plugins/rails_extensions.rb

Overview

The RailsExtensions plugin adds a single class method to Sequel::Model in order to make its use in controllers a little more like ActiveRecord’s. The find! method is added which will raise an exception if no object is found. By adding the following code to a Railtie:

config.action_dispatch.rescue_responses.merge!(
 'Sequel::Plugins::RailsExtensions::ModelNotFound' => :not_found
)

Usage:

# Apply plugin to all models:
Sequel::Model.plugin :rails_extensions

# Apply plugin to a single model:
Album.plugin :rails_extensions

Defined Under Namespace

Modules: ClassMethods Classes: ModelNotFound