
15 Sep
2023
15 Sep
'23
8:11 a.m.
Issue #19884 has been updated by sawa (Tsuyoshi Sawada). Currently, you can do `ActiveRecord::Base.some_method rescue nil` Using `&.` for rescuing an error changes its meaning. ---------------------------------------- Feature #19884: Make Safe Navigation Operator work on classes https://bugs.ruby-lang.org/issues/19884#change-104616 * Author: p8 (Petrik de Heus) * Status: Open * Priority: Normal ---------------------------------------- If a class might not be defined we need to add a conditional: ```ruby defined?(ActiveRecord::Base) && ActiveRecord::Base.some_method ``` It would be nice if we could use the Safe Navigation Operator instead. ```ruby ActiveRecord::Base&.some_method ``` -- https://bugs.ruby-lang.org/