@@ -227,7 +227,7 @@ def exception_class_allowed?(e)
227227 end
228228
229229 def default_processor_klass = ( default_processor_klass )
230- ActiveSupport :: Deprecation . warn ( '`default_processor_klass` has been replaced by `default_processor_klass_name`.' )
230+ JSONAPI . warn_deprecated ( '`default_processor_klass` has been replaced by `default_processor_klass_name`.' )
231231 @default_processor_klass = default_processor_klass
232232 end
233233
@@ -241,18 +241,18 @@ def default_processor_klass_name=(default_processor_klass_name)
241241 end
242242
243243 def allow_include = ( allow_include )
244- ActiveSupport :: Deprecation . warn ( '`allow_include` has been replaced by `default_allow_include_to_one` and `default_allow_include_to_many` options.' )
244+ JSONAPI . warn_deprecated ( '`allow_include` has been replaced by `default_allow_include_to_one` and `default_allow_include_to_many` options.' )
245245 @default_allow_include_to_one = allow_include
246246 @default_allow_include_to_many = allow_include
247247 end
248248
249249 def whitelist_all_exceptions = ( allow_all_exceptions )
250- ActiveSupport :: Deprecation . warn ( '`whitelist_all_exceptions` has been replaced by `allow_all_exceptions`' )
250+ JSONAPI . warn_deprecated ( '`whitelist_all_exceptions` has been replaced by `allow_all_exceptions`' )
251251 @allow_all_exceptions = allow_all_exceptions
252252 end
253253
254254 def exception_class_whitelist = ( exception_class_allowlist )
255- ActiveSupport :: Deprecation . warn ( '`exception_class_whitelist` has been replaced by `exception_class_allowlist`' )
255+ JSONAPI . warn_deprecated ( '`exception_class_whitelist` has been replaced by `exception_class_allowlist`' )
256256 @exception_class_allowlist = exception_class_allowlist
257257 end
258258
@@ -314,12 +314,28 @@ def exception_class_whitelist=(exception_class_allowlist)
314314 end
315315
316316 class << self
317- attr_accessor :configuration
318- end
317+ attr_writer :configuration
319318
320- @configuration ||= Configuration . new
319+ def configuration
320+ @configuration ||= Configuration . new
321+ end
322+ end
321323
322324 def self . configure
323- yield ( @configuration )
325+ yield ( configuration )
326+ end
327+
328+ # Rails 7.2+ made ActiveSupport::Deprecation.warn a private method
329+ # This helper provides backward-compatible deprecation warnings
330+ def self . warn_deprecated ( message )
331+ if defined? ( ActiveSupport ::Deprecation ) && ActiveSupport ::Deprecation . respond_to? ( :warn )
332+ # Rails < 7.2
333+ ActiveSupport ::Deprecation . warn ( message )
334+ else
335+ # Rails 7.2+ or fallback - use standard warning with deprecation formatting
336+ # Rails 7.2 doesn't provide a public API for custom deprecation warnings
337+ # So we use Kernel#warn with a deprecation prefix
338+ warn "[DEPRECATION] #{ message } "
339+ end
324340 end
325341end
0 commit comments