padrino/padrino-framework · error · Padrino::Admin::Generators::OrmError

Adapter #{orm} is not yet supported!

Error message

Adapter #{orm} is not yet supported!

What it means

Orm#columns introspects schema metadata for the admin page generator via a case over the orm symbol; anything outside activerecord/minirecord/mongoid/sequel/ohm/dynamoid falls through to else and raises OrmError. It fires lazily on first use because @columns memoizes — typically when the generator asks for field metadata during admin_page generation.

Source

Thrown at padrino-admin/lib/padrino-admin/generators/orm.rb:59

          when :string                      then :text_field
          when :text                        then :text_area
          when :boolean                     then :check_box
          else :text_field
          end
        end

        Column = Struct.new(:name, :type) # for compatibility

        def columns
          @columns ||=
            case orm
            when :activerecord then @klass.columns
            when :minirecord   then @klass.columns
            when :mongoid      then @klass.fields.values.reject { |col| %w[_id _type].include?(col.name) }
            when :sequel       then @klass.db_schema.map { |k, v| v[:type] = :text if v[:db_type] =~ /^text/i; Column.new(k, v[:type]) }
            when :ohm          then @klass.attributes.map { |a| Column.new(a.to_s, :string) } # ohm has strings
            when :dynamoid     then @klass.attributes.map { |k, v| Column.new(k.to_s, v[:type]) }
            else raise OrmError, "Adapter #{orm} is not yet supported!"
            end
        end

        def column_fields
          excluded_columns = %w[created_at updated_at] << (orm == :mongoid ? '_id' : 'id')
          column_fields    = columns.dup
          column_fields.reject! { |column| excluded_columns.include?(column.name.to_s) }
          @column_fields ||= column_fields.map do |column|
            { name: column.name, field_type: field_type(column.type) }
          end
        end

        def all
          "#{klass_name}.all"
        end

        def find(params = nil)
          case orm

View on GitHub (pinned to 167044f3d5)

Solutions

  1. Use one of the supported adapter symbols: :activerecord, :minirecord, :mongoid, :sequel, :ohm, :dynamoid
  2. Inspect the value passed as orm — initialization does not validate it, so a misspelling only surfaces here
  3. For custom schemas, pass explicit columns/column_fields to Orm.new and avoid #columns, or subclass Orm and override the case

Example fix

# before
Padrino::Admin::Generators::Orm.new('Post', :datamapper).columns

# after
Padrino::Admin::Generators::Orm.new('Post', :activerecord).columns
Defensive patterns

Strategy: type-guard

Validate before calling

SUPPORTED = %i[activerecord minirecord mongoid sequel ohm dynamoid].freeze
raise ArgumentError, orm unless SUPPORTED.include?(orm.to_sym)
Padrino::Admin::Generators::Orm.new('Post', orm).columns

Type guard

SUPPORTED_ORMS = %i[activerecord minirecord mongoid sequel ohm dynamoid].freeze
def supported_orm?(orm) = SUPPORTED_ORMS.include?(orm.to_sym)

Try / catch

begin
  orm_helper.columns
rescue Padrino::Admin::Generators::OrmError => e
  abort "#{e.message} — use one of #{SUPPORTED_ORMS.join('/')}"
end

Prevention

When it happens

Trigger: Building Padrino::Admin::Generators::Orm.new('Post', :datamapper) (or any unsupported/misspelled symbol) and calling .columns or .column_fields; programmatic reuse of Generators::Orm with a custom adapter string that was symbolized but never validated.

Common situations: DataMapper or other legacy adapters after a Padrino upgrade; a typo in the adapter passed by surrounding code (orm is symbolized via to_sym so the typo survives initialize); writing a plugin that reuses Generators::Orm for a new ORM without extending the case list.

Related errors


AI-assisted analysis of padrino/padrino-framework@167044f3d5 (2026-08-23). Data as JSON: /api/errors/5529db07738f8864. Report an issue: GitHub.