Warnings: Use alias_method > alias_attribute for non-attributes#45
Warnings: Use alias_method > alias_attribute for non-attributes#45
alias_method > alias_attribute for non-attributes#45Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #45 +/- ##
=======================================
Coverage 98.68% 98.68%
=======================================
Files 102 102
Lines 2664 2664
=======================================
Hits 2629 2629
Misses 35 35 ☔ View full report in Codecov by Sentry. |
|
This one's ready. No functional change at all, just swapping a method for a Rails 7.2 compatibility |
|
@joshmn any chance you could take a peek at this one? |
|
Any chance of getting this merged in? With rails 7.2 being officially released this is a blocker for sure. |
|
All, I've reached out to @joshmn a couple of times... if he remains unavailable for another week or two, I will (sadly) fork this project and keep it up to date. I'm not sure exactly why he's been MIA lately. This gem should never block Rails upgrades. |
|
Welp, figured that out. https://www.yahoo.com/tech/man-ran-website-illegally-streamed-214600421.html?guccounter=1 Guess a fork is on the way. |
|
For folks that are watching and/or find this issue, I've been pretty busy in life so I haven't had time to spin up a proper fork and try to wrestle all the side-effects that come with that. For now, I offer a monkey-patch. I've stuffed this code into my require_dependency 'caffeinate/application_record'
require_dependency 'caffeinate/campaign_subscription'
require_dependency 'caffeinate/mailing'
Caffeinate::CampaignSubscription.class_eval do
# Define caffeinate_campaign as a virtual attribute
attribute :caffeinate_campaign, :string # Use the appropriate type if it's not a string
# Alias campaign to caffeinate_campaign
alias_method :campaign, :caffeinate_campaign
end
Caffeinate::Mailing.class_eval do
# Define caffeinate_campaign_subscription as a virtual attribute
attribute :caffeinate_campaign_subscription, :string # Use the appropriate type if it's not a string
attribute :caffeinate_campaign, :string # Use the appropriate type if it's not a string
# Alias subscription to caffeinate_campaign_subscription
alias_method :subscription, :caffeinate_campaign_subscription
alias_method :campaign, :caffeinate_campaign
endThis matches the three places I resolved in this PR and sets up a virtual attribute (which will immediately get overridden by ActiveRecord) to prevent the Rails 8 error from occurring, then an |
Eliminate nags!
Fixes #43