const_missing calls Dependencies.load_missing_constant(Object, :Store).
4. load_missing_constant attempts to find and load store.rb somewhere in its list of load
paths (Dependencies.load_paths). It fails to find such a file.
5. load_missing_constant sees that app/models/store exists and is a directory. It creates a
module, assigns it to the appropriate constant, and returns.
Deprecation deprecation.rb
The ActiveSupport::Deprecation module provides a method by which old APIs are marked
for removal. At its core, it is just a fancy warning mechanism. When old APIs are used, they
generate a warning in development or test mode. Deprecation warnings are invoked
through the ActiveSupport::Deprecation.warn(message, callstack) method. The
ActiveSupport::Deprecation.silence method silences those warnings for the duration of
the provided block.
The deprecate class method provides an easy way to mark a method as deprecated while
still making it available. It decorates the given method with the deprecation warning.
def find_first(conditions = nil, orderings = nil, joins = nil) # :nodoc:
find(:first, :conditions => conditions, :order => orderings, :joins => joins)
end
deprecate :find_first => "use find(:first, ...)"
ActiveSupport::Deprecation.behavior is a Proc that is called when a deprecation warning is
triggered. It takes two arguments: the deprecation message and the callstack.
Pages:
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98