Skip to content

rails db:seed needs several runs #11119

@ChrisBAshton

Description

@ChrisBAshton
$ run rails db:seed                                                                                                                                                

bin/rails aborted!
ArgumentError: After commit callback :publish_to_publishing_api has not been defined (ArgumentError)

                raise ArgumentError, "#{type.to_s.capitalize} #{name} callback #{filter.inspect} has not been defined"
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
/govuk/whitehall/db/seeds.rb:30:in `<main>'
Tasks: TOP => db:seed
(See full trace by running task with --trace)

$ run rails db:seed

bin/rails aborted!
NoMethodError: undefined method `content_id' for nil (NoMethodError)

        world_location_news: [item.world_location_news.content_id],
                                                      ^^^^^^^^^^^
/govuk/whitehall/app/presenters/publishing_api/world_location_presenter.rb:33:in `links'
/govuk/whitehall/lib/whitehall/publishing_api.rb:87:in `patch_links'
/govuk/whitehall/lib/publishes_to_publishing_api.rb:33:in `block in publish_to_publishing_api'
/govuk/whitehall/lib/publishes_to_publishing_api.rb:32:in `publish_to_publishing_api'
/govuk/whitehall/db/seeds.rb:54:in `<main>'
Tasks: TOP => db:seed
(See full trace by running task with --trace)

# third attempt worked

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