Skip to content

NoMethodError: undefined method 'scan' for nil when dumping schema with Rails 8.0.2 + Ruby 3.4.5 #111

@denizcay

Description

@denizcay

When using torque-postgresql with Rails 8.0.2 and Ruby 3.4.5, rake db:schema:dump does not work correctly. It fails for table ('products') that include Postgres-specific types or triggers. As a result, none of the triggers defined in the project appear in the generated schema.rb.

Instead of dumping the schema, I get:

# Could not dump table "public.products" because of following NoMethodError
# undefined method `scan` for nil:NilClass

Without the gem, the schema dump works as expected: the table is included and all triggers are present.

  1. Rails app with:

    • Ruby 3.4.5
    • Rails 8.0.2
    • Postgres 14.18
    • gem 'torque-postgresql', '~> 4.0'
  2. Add a table that contains:

    • jsonb columns with default '{}'::jsonb
    • array columns (character varying[], integer[]) with default '{}'::...[]
    • a tsvector column
    • triggers on the table
  3. Run:

    rails db:migrate
    rails db:schema:dump
    

Removing the gem makes the schema dump succeed (table + triggers appear).
I think using config.active_record.schema_format = :sql is a workaround, but I would prefer to keep schema.rb.

Any help or guidance on fixing this issue in Rails 8 would be greatly appreciated.
Thanks in advance for your support and for maintaining this gem!

Metadata

Metadata

Assignees

Labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions