Skip to content

New Rails Solid models produce "Ignoring invalid model" warning, can't be excluded #423

@philliplongman

Description

@philliplongman

With SolidCable, SolidCache, and SolidQueue, Rails has added new internal models which aren't automatically ignored by rails-erd. Every time it runs, I get the following:

Warning: Ignoring invalid model SolidCable::Message (table solid_cable_messages does not exist)
Warning: Ignoring invalid model SolidCache::Entry (table solid_cache_entries does not exist)
Warning: Ignoring invalid model SolidQueue::Semaphore (table solid_queue_semaphores does not exist)
Warning: Ignoring invalid model SolidQueue::RecurringTask (table solid_queue_recurring_tasks does not exist)
Warning: Ignoring invalid model SolidQueue::Process (table solid_queue_processes does not exist)
Warning: Ignoring invalid model SolidQueue::Pause (table solid_queue_pauses does not exist)
Warning: Ignoring invalid model SolidQueue::Job (table solid_queue_jobs does not exist)
Warning: Ignoring invalid model SolidQueue::ScheduledExecution (table solid_queue_scheduled_executions does not exist)
Warning: Ignoring invalid model SolidQueue::RecurringExecution (table solid_queue_recurring_executions does not exist)
Warning: Ignoring invalid model SolidQueue::ReadyExecution (table solid_queue_ready_executions does not exist)
Warning: Ignoring invalid model SolidQueue::FailedExecution (table solid_queue_failed_executions does not exist)
Warning: Ignoring invalid model SolidQueue::ClaimedExecution (table solid_queue_claimed_executions does not exist)
Warning: Ignoring invalid model SolidQueue::BlockedExecution (table solid_queue_blocked_executions does not exist)
Warning: Ignoring invalid association :job on SolidQueue::Execution (model SolidQueue::Job exists, but is not included in domain)

Excluding these models in my config file does nothing to suppress the warning.

It seems to me that if I tell rails-erd to ignore a model in the config file, it shouldn't print out any warnings for it in the first place.

However, there's an easy patch for the immediate problem. Someone just needs to update RailsERD::Domain#rails_models with the new classes:

    def rails_models
      %w(
        ActionMailbox::InboundEmail
        ActionText::EncryptedRichText
        ActionText::RichText
        ActiveStorage::Attachment
        ActiveStorage::Blob
        ActiveStorage::VariantRecord
        SolidCable::Message
        SolidCache::Entry
        SolidQueue::BlockedExecution
        SolidQueue::ClaimedExecution
        SolidQueue::Execution
        SolidQueue::FailedExecution
        SolidQueue::Job
        SolidQueue::Pause
        SolidQueue::Process
        SolidQueue::ReadyExecution
        SolidQueue::RecurringExecution
        SolidQueue::RecurringTask
        SolidQueue::ScheduledExecution
        SolidQueue::Semaphore
      ).map{ |model| Object.const_get(model) rescue nil }.compact
    end

I'm willing to make a pull request for it.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions