Skip to content

Commit fac3bde

Browse files
authored
Merge pull request rails#42642 from jhawthorn/registered_details_to_ivar
Replace cvar with ivar for registered_details
2 parents c3fe14c + eeea496 commit fac3bde

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

actionview/lib/action_view/lookup_context.rb

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,8 @@ module ActionView
1515
class LookupContext #:nodoc:
1616
attr_accessor :prefixes, :rendered_format
1717

18-
mattr_accessor :registered_details, default: []
18+
singleton_class.attr_accessor :registered_details
19+
self.registered_details = []
1920

2021
def self.register_detail(name, &block)
2122
registered_details << name
@@ -176,7 +177,7 @@ def detail_args_for_any
176177
@detail_args_for_any ||= begin
177178
details = {}
178179

179-
registered_details.each do |k|
180+
LookupContext.registered_details.each do |k|
180181
if k == :variants
181182
details[k] = :any
182183
else
@@ -238,7 +239,7 @@ def with_prepended_formats(formats)
238239
end
239240

240241
def initialize_details(target, details)
241-
registered_details.each do |k|
242+
LookupContext.registered_details.each do |k|
242243
target[k] = details[k] || Accessors::DEFAULT_PROCS[k].call
243244
end
244245
target

actionview/lib/action_view/renderer/abstract_renderer.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ def format
158158

159159
def extract_details(options) # :doc:
160160
details = nil
161-
@lookup_context.registered_details.each do |key|
161+
LookupContext.registered_details.each do |key|
162162
value = options[key]
163163

164164
if value

0 commit comments

Comments
 (0)