Skip to content

Comments

667: Fix missing coder for Rails 7.1#668

Closed
sjieg wants to merge 1 commit intorpush:20240829-rails-7.1from
sjieg:master
Closed

667: Fix missing coder for Rails 7.1#668
sjieg wants to merge 1 commit intorpush:20240829-rails-7.1from
sjieg:master

Conversation

@sjieg
Copy link

@sjieg sjieg commented Jul 31, 2024

Fixes #667

@benlangfeld
Copy link
Collaborator

#675 seems to show that more is required for Rails 7.1 support. Any ideas on the failing tests there?

@sjieg
Copy link
Author

sjieg commented Sep 3, 2024

#675 seems to show that more is required for Rails 7.1 support. Any ideas on the failing tests there?

Having a quick peek at the errors I see a lot of

undefined method `attribute' for #<Rpush::Client::Redis::Webpush::App:

I would guess that instead of thing.attribute(:name, "value") it's now obsolete and you need to refactor to thing.attributes(name: "value")
But I can't pinpoint in the code where this originates from right now.

@benlangfeld benlangfeld added this to the 8.1.0 milestone Sep 5, 2024
@benlangfeld
Copy link
Collaborator

In #675, dealing with upstream Rails breakage by ignoring 7.1.4 (assuming the fix which broke it will be in 7.1.5), there are no test failures.

I'd appreciate if you would test again at that version of rpush and if the problem still exists, help me understand why it's not causing any test failures or write a test which fails without this fix.

@WoutDev
Copy link
Contributor

WoutDev commented Sep 17, 2024

I'd love to see this fixed ASAP. Can I help with anything?

I'm actually already running Rpush (v7.0.1) on Rails 7.1.3.4 for a while now, I was not aware it was not supported. We are now noticing a lot of GCM DeprecatedApi errors and want to start using FCM with Rails 7.1 ASAP.

@benlangfeld
Copy link
Collaborator

@WoutDev You can help by testing #675 to confirm if this PR is actually required or not.

@sjieg
Copy link
Author

sjieg commented Sep 19, 2024

Hey @WoutDev @benlangfeld I had a look at running the tests locally (WSL2) but unfortunately I ran out of time to get it to work.

Feel free to merge this PR into your more generic Rails 7.1 PR and close this one @benlangfeld 🇳🇱

@benlangfeld
Copy link
Collaborator

@sjieg I need to figure out how to reproduce whatever failure you saw in a test to serve as justification for this change, TDD style.

@WoutDev
Copy link
Contributor

WoutDev commented Sep 19, 2024

My hypothesis is that this is actually a railties thing and Rpush does not use it, hence no failing tests.

The default of 'nil' is defined in railties:
https://github.com/rails/rails/blob/main/railties/lib/rails/application/configuration.rb#L289

I don't think this project uses railties, so if the default is not set then perhaps this default (YAML) is used instead:
https://github.com/rails/rails/blob/main/activerecord/lib/active_record/attribute_methods/serialization.rb#L20

And that would explain the passing tests.

The documentation mentioning the default of 'nil' linked in the original issue also hints at this:

[...] The default value depends on the config.load_defaults target version:

As load_defaults is a railties thing.

@benlangfeld
Copy link
Collaborator

benlangfeld commented Sep 19, 2024

Makes sense, thanks @WoutDev. I wonder if we should simply set the default to nil in our test suite to simulate Rails' behaviour.

@benlangfeld benlangfeld changed the base branch from master to 20240829-rails-7.1 September 19, 2024 17:36
@benlangfeld benlangfeld deleted the branch rpush:20240829-rails-7.1 September 19, 2024 19:16
@benlangfeld
Copy link
Collaborator

I included a variation of this in #675 and that is now on the master branch.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Rails 7.1: ArgumentError: missing keyword: :coder If no default coder is configured, a coder must be provided to serialize.

3 participants