This probably sounds crazy but has it even been considered to either have a 
way to register constants for an autoloaded class so they will be undefined 
before reload, or maybe even just a class method to do:

def_const(:SOME_CONSTANT, value)

that would:

def def_const(constant, value)
  remove_const(constant) if const_defined?(constant)
  constant = value
end

Some say to put constants where they aren't autoloaded (like in 
initializers) and other even suggest using methods, but that defeats the 
purpose of using constants. So does the method above, but it is more in 
line with what Rails autoloading promises.

Seems like avoiding the problem makes some consider just using magic 
numbers in code which is like stepping back into time.

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Core" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/rubyonrails-core/-/Rz8JI59_fV0J.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-core?hl=en.

Reply via email to