Skip to content

Conversation

nourmat
Copy link
Contributor

@nourmat nourmat commented Jul 20, 2025

Add support for read_attribute method

Changes

  • Added alias_method :read_attribute, :[] to support Rails 7.1+ read_attribute method
  • Added comprehensive tests for read_attribute, _read_attribute, and [] methods
  • Tests verify functionality with both symbol and string keys

Why

Rails 7.1+ introduced read_attribute as a public method for external usage, similar to record['id']. This change ensures compatibility with newer Rails versions.
It's called in other gems e.g Bullet version 8.0.8 uses this public method here which causes errors in specs like RSpec::Mocks::MockExpectationError

@nourmat
Copy link
Contributor Author

nourmat commented Jul 21, 2025

Hey @JonRowe 👋 , I see the CI Rspec CI / Ruby: 2.7 failed due to timeout request, is this a known thing, or I should fix something?

@nourmat nourmat force-pushed the add-support-for-read-attribute branch 2 times, most recently from b83fa80 to d0e04cc Compare July 23, 2025 14:54
@pirj

This comment was marked as resolved.

@nourmat nourmat force-pushed the add-support-for-read-attribute branch from d0e04cc to 6fcf4d8 Compare July 23, 2025 15:07
@nourmat
Copy link
Contributor Author

nourmat commented Jul 23, 2025

yeah, I messed something unintentionally, fixing it now

@nourmat nourmat force-pushed the add-support-for-read-attribute branch from 6fcf4d8 to e440d40 Compare July 23, 2025 15:20
@nourmat
Copy link
Contributor Author

nourmat commented Jul 28, 2025

Hey @pirj @JonRowe, Can you please approve the workflow if there is no review comments :) Thanks!

@pirj
Copy link
Member

pirj commented Jul 28, 2025

I can’t in this repo @JonRowe 😓

@nourmat
Copy link
Contributor Author

nourmat commented Jul 28, 2025

No worries, let's wait for Jon :D

@nourmat
Copy link
Contributor Author

nourmat commented Aug 3, 2025

Hey @JonRowe, should I fix those rubocop errors in my PR, they are not related?
Also, they were not detected locally until I deleted my local Gemfile.lock and re ran bundle install

It's due to the new version of Rubocop

@nourmat
Copy link
Contributor Author

nourmat commented Aug 3, 2025

@JonRowe, I just went ahead and fixed the new rubocop errors, made since I guess.

JonRowe added a commit that referenced this pull request Aug 7, 2025
@JonRowe
Copy link
Member

JonRowe commented Aug 7, 2025

Merged in 32c7de3

@JonRowe JonRowe closed this Aug 7, 2025
@JonRowe
Copy link
Member

JonRowe commented Aug 7, 2025

Released in 1.3.0, thank you!

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.

3 participants