On Mar 25, 8:22 pm, Bharat Ruparel <[email protected]>
wrote:
> "The difference with a file like the one you had is that there
> isn't a top level constant one would naturally refer to)"
>
> Thanks for the explanation Fred. But I don't understand this. Can you
> give me a simple example?
>
If what you were doing was providing a class that other bits of your
app use then you might have discombobulator.rb which defined
Discombobulator, and bits of your app might do
Discombobulator.discombobulate. When they did that and if the file had
not been loaded yet then this would trigger const_missing (since there
is no Discombobulator constant). Rails' response to this is to search
for a file called discombobulator.rb and try and load it.
However when you have a file in lib that is just adding a method to
some existing class or overriding something then there is no constant
like Discombobulator that will trigger loading of the file.
Fred
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby
on Rails: Talk" group.
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-talk?hl=en
-~----------~----~----~----~------~----~------~--~---