Sha256: bc0a05f5571970811538cf61aa8276a650ec535fd727641a58672efeaf247f64

Contents?: true

Size: 1.73 KB

Versions: 19

Compression:

Stored size: 1.73 KB

Contents

# frozen_string_literal: true

module Decidim
  module Attributes
    autoload :TimeWithZone, "decidim/attributes/time_with_zone"
    autoload :LocalizedDate, "decidim/attributes/localized_date"
    autoload :CleanString, "decidim/attributes/clean_string"
    autoload :Blob, "decidim/attributes/blob"
    autoload :Array, "decidim/attributes/array"
    autoload :Hash, "decidim/attributes/hash"
    autoload :Object, "decidim/attributes/object"
    autoload :Model, "decidim/attributes/model"
    autoload :Symbol, "decidim/attributes/symbol"
    autoload :Integer, "decidim/attributes/integer"

    # Base types
    ActiveModel::Type.register(:array, Decidim::Attributes::Array)
    ActiveModel::Type.register(:hash, Decidim::Attributes::Hash)
    ActiveModel::Type.register(:object, Decidim::Attributes::Object)
    ActiveModel::Type.register(:model, Decidim::Attributes::Model)
    ActiveModel::Type.register(:symbol, Decidim::Attributes::Symbol)

    # Synonyms
    ActiveModel::Type.register(:date_time, ActiveModel::Type::DateTime) # Synonym for :datetime

    # Extra types
    ActiveModel::Type.register(:"decidim/attributes/time_with_zone", Decidim::Attributes::TimeWithZone)
    ActiveModel::Type.register(:"decidim/attributes/localized_date", Decidim::Attributes::LocalizedDate)
    ActiveModel::Type.register(:"decidim/attributes/clean_string", Decidim::Attributes::CleanString)
    ActiveModel::Type.register(:"decidim/attributes/blob", Decidim::Attributes::Blob)

    # Overrides
    # The overrides deletion can be omitted after upgrade to Rails 7.0 (delete this after upgrade)
    ActiveModel::Type.registry.send(:registrations).delete_if { |r| r.send(:name) == :integer }

    ActiveModel::Type.register(:integer, Decidim::Attributes::Integer)
  end
end

Version data entries

19 entries across 19 versions & 1 rubygems

Version Path
decidim-core-0.28.4 lib/decidim/attributes.rb
decidim-core-0.27.9 lib/decidim/attributes.rb
decidim-core-0.28.3 lib/decidim/attributes.rb
decidim-core-0.27.8 lib/decidim/attributes.rb
decidim-core-0.28.2 lib/decidim/attributes.rb
decidim-core-0.27.7 lib/decidim/attributes.rb
decidim-core-0.28.1 lib/decidim/attributes.rb
decidim-core-0.27.6 lib/decidim/attributes.rb
decidim-core-0.28.0 lib/decidim/attributes.rb
decidim-core-0.27.5 lib/decidim/attributes.rb
decidim-core-0.28.0.rc5 lib/decidim/attributes.rb
decidim-core-0.28.0.rc4 lib/decidim/attributes.rb
decidim-core-0.27.4 lib/decidim/attributes.rb
decidim-core-0.27.3 lib/decidim/attributes.rb
decidim-core-0.27.2 lib/decidim/attributes.rb
decidim-core-0.27.1 lib/decidim/attributes.rb
decidim-core-0.27.0 lib/decidim/attributes.rb
decidim-core-0.27.0.rc2 lib/decidim/attributes.rb
decidim-core-0.27.0.rc1 lib/decidim/attributes.rb