Skip to content

[BAC-336] Move AJ serializer to AME from voices - #17

Merged
HolyWalley merged 2 commits into
masterfrom
feature/BAC-336
Jul 8, 2025
Merged

[BAC-336] Move AJ serializer to AME from voices#17
HolyWalley merged 2 commits into
masterfrom
feature/BAC-336

Conversation

@HolyWalley

Copy link
Copy Markdown
Contributor

No description provided.

@HolyWalley HolyWalley self-assigned this Jul 8, 2025
@HolyWalley
HolyWalley requested review from Copilot, taleh007 and yard July 8, 2025 10:53
@HolyWalley
HolyWalley marked this pull request as ready for review July 8, 2025 10:53

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR introduces support for serializing ActiveModel::Entity objects in ActiveJob, integrates the serializer via a Railtie, and adds a round-trip serialization spec.

  • Add ActiveModelSerializer under ActiveJob::Serializers to handle Entity serialization/deserialization.
  • Register the serializer through a new Railtie initializer when Rails and ActiveJob are present.
  • Add a spec to verify that an Entity instance can be serialized and deserialized via ActiveJob::Arguments.
  • Declare the activejob gem dependency in the Gemfile.

Reviewed Changes

Copilot reviewed 5 out of 6 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
spec/active_model/entity/active_job_spec.rb New spec verifying round-trip serialization of an Entity instance.
lib/active_model/entity/railtie.rb Railtie initializer to register the Entity serializer with ActiveJob.
lib/active_model/entity/active_job.rb Implementation of ActiveModelSerializer for ActiveModel::Entity.
lib/active_model/entity.rb Conditional load of the Railtie when Rails is detected.
Gemfile Adds activejob gem to enable ActiveJob integration.
Comments suppressed due to low confidence (1)

lib/active_model/entity/railtie.rb:7

  • Consider adding a spec to verify that the Railtie actually registers ActiveModelSerializer in Rails.application.config.active_job.custom_serializers when Rails and ActiveJob are loaded.
      initializer "activemodel_entity.configure_active_job_serializer" do


if defined?(ActiveJob::Serializers::ActiveModelSerializer)
Rails.application.config.to_prepare do
Rails.application.config.active_job.custom_serializers << ActiveJob::Serializers::ActiveModelSerializer

Copilot AI Jul 8, 2025

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To prevent duplicate registrations on each to_prepare run (e.g., in development reloads), guard this with an inclusion check, e.g.: unless config.active_job.custom_serializers.include?(...).

Suggested change
Rails.application.config.active_job.custom_serializers << ActiveJob::Serializers::ActiveModelSerializer
unless Rails.application.config.active_job.custom_serializers.include?(ActiveJob::Serializers::ActiveModelSerializer)
Rails.application.config.active_job.custom_serializers << ActiveJob::Serializers::ActiveModelSerializer
end

Copilot uses AI. Check for mistakes.
@HolyWalley
HolyWalley merged commit c3a5d12 into master Jul 8, 2025
1 check passed
@HolyWalley
HolyWalley deleted the feature/BAC-336 branch July 8, 2025 11:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants