Module | Sequel::Plugins::ForceEncoding
In: | lib/sequel/plugins/force_encoding.rb

The ForceEncoding plugin allows you force specific encodings for all strings that are used by the model. When model instances are loaded from the database, all values in the hash that are strings are forced to the given encoding. Whenever you update a model column attribute, the resulting value is forced to a given encoding if the value is a string. There are two ways to specify the encoding. You can either do so in the plugin call itself, or via the forced_encoding class accessor:

      class Album < Sequel::Model
        plugin :force_encoding, 'UTF-8'
        # or
        plugin :force_encoding
        self.forced_encoding = 'UTF-8'
      end

### Methods

configure

### Classes and Modules

Module Sequel::Plugins::ForceEncoding::ClassMethods
Module Sequel::Plugins::ForceEncoding::InstanceMethods

### Public Class methods

configure(model, encoding=nil)

Set the forced_encoding based on the value given in the plugin call. Note that if a the plugin has been previously loaded, any previous forced encoding is overruled, even if no encoding is given when calling the plugin.

[Source]

        # File lib/sequel/plugins/force_encoding.rb, line 24
    24:       def self.configure(model, encoding=nil)
    25:         model.forced_encoding = encoding
    26:       end

[Validate]