Ah. Wasn't thinking that the constants in 
ActiveSupport::Dependencies::Reference don't include everything. :)

Needed to store the class for later retrieval and then:
Object.send(:remove_const, :Journey)

I think may be fixed in current version of Constance gem. Try:
Constance::Resolver.will_replace(Journey)

Unfortunately the example search regexps on the caller stack may be 
inadequate because lib is in just about every gem so would need to prefix 
with your app name.

On Friday, October 5, 2012 12:16:10 AM UTC-4, Gary Weaver wrote:
>
> Looks like it still needs some work. It works with resolving other 
> classes, but even if I try to remove Journey from the class cache with:
> ActiveSupport::Dependencies::Reference.clear!
>
> that doesn't work. Oh well, sorry. It makes a decent dependency debugger 
> though.
>
> On Thursday, October 4, 2012 11:37:11 PM UTC-4, Gary Weaver wrote:
>>
>> Got constance working and it is sweet like candy (like old-tyme candy 
>> back before they knew how to make candy, so forgive me if it sucks). This 
>> might solve the common-noun constant problem. Try it out and let me know.
>> https://github.com/garysweaver/constance
>>
>>
>> On Saturday, September 22, 2012 9:41:52 AM UTC-4, Gary Weaver wrote:
>>>
>>>
>>>
>>> On Friday, September 21, 2012 12:09:23 PM UTC-4, Gary Weaver wrote:
>>>
>>>> That isn't efficient and still doesn't help, but if you took that yet 
>>>> another step further, you could change autoloading such that it keeps 
>>>> track 
>>>> of whether the class was loaded locally or not, and if it was, it would 
>>>> use 
>>>> your Journey class, otherwise it would use some other gem's Journey. You 
>>>> could generify the gem and call it StevePerry or maybe just Perry. Hmm.. 
>>>> might do that later.
>>>>
>>>>
>>> Ok, this is not done/working yet, but is a start. Was thinking that 
>>> maybe looking at caller stack might be better to attempt to determine 
>>> whether class is being referenced locally, so not messing with autoload. 
>>> However, I have a feeling this won't work unless the Journey constant is 
>>> uncached on each reference. My daughter is extremely bored waiting on me 
>>> currently, so gotta run for now:
>>> https://github.com/garysweaver/constance
>>>
>>

-- 
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/-/DaL-CBR2yoEJ.
To post to this group, send email to rubyonrails-core@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-core+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-core?hl=en.

Reply via email to