public-activity/public_activity · error

[WARN] table #{name} doesn't exist. Skipping PublicActivity:

Error message

[WARN] table #{name} doesn't exist. Skipping PublicActivity::Activity#parameters's serialization

What it means

Error "[WARN] table #{name} doesn't exist. Skipping PublicActivity::Activity#parameters's serialization" thrown in public-activity/public_activity.

Source

Thrown at lib/public_activity/orm/active_record/activity.rb:47

        with_options(optional: true) do
          # Define ownership to a resource responsible for this activity
          belongs_to :owner, polymorphic: true
          # Define ownership to a resource targeted by this activity
          belongs_to :recipient, polymorphic: true
        end

        # Serialize parameters Hash
        begin
          if table_exists?
            unless %i[json jsonb hstore].include?(columns_hash['parameters'].type)
              if ::ActiveRecord.version.release < Gem::Version.new('7.1')
                serialize :parameters, Hash
              else
                serialize :parameters, coder: YAML, type: Hash
              end
            end
          else
            warn("[WARN] table #{name} doesn't exist. Skipping PublicActivity::Activity#parameters's serialization")
          end
        rescue ::ActiveRecord::NoDatabaseError
          warn("[WARN] database doesn't exist. Skipping PublicActivity::Activity#parameters's serialization")
        rescue ::ActiveRecord::ConnectionNotEstablished, ::PG::ConnectionBad, Mysql2::Error::ConnectionError
          warn("[WARN] couldn't connect to database. Skipping PublicActivity::Activity#parameters's serialization")
        end
      end
    end
  end
end

View on GitHub (pinned to 1f3a5568ad)

Solutions

  1. Run the PublicActivity migration: rails generate public_activity:migration && rails db:migrate.
  2. Confirm the configured table name matches the migrated table: PublicActivity.config.table_name (default 'activities').
  3. If the model loads before migrations (e.g. during assets:precompile), the warning is harmless; the serialization block is skipped.

Example fix

rails generate public_activity:migration
rails db:migrate

When it happens

Trigger: Emitted when the PublicActivity::Activity model class is loaded and table_exists? returns false, so the serializer for the parameters column cannot be configured. Typical during boot before migrations have run (fresh database, db:migrate not yet executed), in rake tasks or console sessions that load the model before the activities table exists, or when the connection points at a schema where the table was renamed or dropped. The warn at lib/public_activity/orm/active_record/activity.rb:47 fires instead of calling serialize, so parameters are not serialized until the app restarts after the table exists.

Common situations: See trigger scenarios.


AI-assisted analysis of public-activity/public_activity@1f3a5568ad (2026-08-23). Data as JSON: /api/errors/779c1196e988cb46. Report an issue: GitHub.