Module | Sequel::Plugins::TypecastOnLoad::ClassMethods
In: | lib/sequel/plugins/typecast_on_load.rb

### Methods

add_typecast_on_load_columns inherited load

### Attributes

typecast_on_load_columns | [R] | The columns to typecast on load for this model.

### Public Instance methods

add_typecast_on_load_columns(*columns)

Add additional columns to typecast on load for this model.

[Source]

        # File lib/sequel/plugins/typecast_on_load.rb, line 35
    35:         def add_typecast_on_load_columns(*columns)
    36:           @typecast_on_load_columns.concat(columns)
    37:         end

inherited(subclass)

Give the subclass a copy of the typecast on load columns.

[Source]

        # File lib/sequel/plugins/typecast_on_load.rb, line 40
    40:         def inherited(subclass)
    41:           super
    42:           subclass.instance_variable_set(:@typecast_on_load_columns, typecast_on_load_columns.dup)
    43:         end

load(values)

Call the setter method for each of the typecast on load columns, ensuring the model object will have the correct typecasting even if the database doesn‘t typecast the columns correctly.

[Source]

        # File lib/sequel/plugins/typecast_on_load.rb, line 48
    48:         def load(values)
    49:           o = super
    50:           typecast_on_load_columns.each do |c|
    51:             if v = values[c]
    52:               o.send("#{c}=", v)
    53:             end
    54:           end
    55:           o.changed_columns.clear
    56:           o
    57:         end

[Validate]