facebook-ruby-business-sdk icon indicating copy to clipboard operation
facebook-ruby-business-sdk copied to clipboard

Ruby 3.4.1 generating warning about redefining 'object_id' in FacebookAds::AdAccount

Open benstein opened this issue 1 year ago • 5 comments

Which SDK version are you using?

facebookbusiness-21.0.2

What's the issue?

Upgraded from Ruby 3.3 to 3.4.1 and this gem is generating the following logs:

.rvm/gems/ruby-3.4.1/gems/facebookbusiness-21.0.2/lib/facebook_ads/fields.rb:30: warning: redefining 'object_id' may cause serious problems

Steps/Sample code to reproduce the issue

Load the FacebookAds::AdAccount class

Observed Results:

$ irb
> FacebookAds::AdAccount
/Users/ben/.rvm/gems/ruby-3.4.1/gems/facebookbusiness-21.0.2/lib/facebook_ads/fields.rb:30: warning: redefining 'object_id' may cause serious problems
/Users/ben/.rvm/gems/ruby-3.4.1/gems/facebookbusiness-21.0.2/lib/facebook_ads/fields.rb:30: warning: redefining 'object_id' may cause serious problems
/Users/ben/.rvm/gems/ruby-3.4.1/gems/facebookbusiness-21.0.2/lib/facebook_ads/fields.rb:30: warning: redefining 'object_id' may cause serious problems
/Users/ben/.rvm/gems/ruby-3.4.1/gems/facebookbusiness-21.0.2/lib/facebook_ads/fields.rb:30: warning: redefining 'object_id' may cause serious problems

Expected Results:

  • What did you expect to happen?

Either suppress the warning if it's actually safe, or a different approach.

benstein avatar Dec 26 '24 03:12 benstein

+1 Issue is also present on version 20.0.4 and 21.0.2(the latest public version at the time this comment is posted)

itsmeurbi avatar Jan 23 '25 23:01 itsmeurbi

The object_id method is now explicitly defined in Ruby 3.4.0, as discussed here: https://bugs.ruby-lang.org/issues/20912. I believe the library should be updated to avoid redefining or overriding the built-in object_id method.

xalmar avatar Mar 25 '25 11:03 xalmar

Clarification: The object_id method has always existed in Ruby, but Ruby 3.4.0 introduced an explicit warning when attempting to redefine it

xalmar avatar Mar 25 '25 11:03 xalmar

I'm encountering the same issue with version 23.0.0. My Ruby version is 3.4.5.

Is there any plan to resolve this issue or a known workaround?

enyuka avatar Jul 23 '25 04:07 enyuka

+1

thomaswitt avatar Oct 02 '25 08:10 thomaswitt