On 12-Sep-09, at 9:03 PM, Rodrigo Rosenfeld Rosas wrote:
> Let me tell you my doubts at the moment. Firstly, I've noted that > ActionModel::Errors#full_messages method is overrided in ActiveRecord > in some way that could be dryer and I would like to know if I can > submit you a patch to make this override dryer. I'm not sure about ActionModel, but we've been working on modifications to ActiveRecord validations over on the Rails I18n list and any code regarding messages is likely going to change in 3.0. You're welcome to come over and discuss your concerns though. > Then, I'd like to know better how Rails initialization works. I have > noticed that validations.rb is required by activerecord using > autoload, while searching the source code. I guess activerecord is > also lazy loaded in Rails, but I didn't find any 'autoload' doing this > explicitly. I guess activerecord is loaded as a gem, but I didn't find > where this lazy loading occurs in gems_dependency.rb, if that is the > place where it happens. Where is lazy loading happing on gems? Initialization is done in Rails::Initializer, and the frameworks (like ActiveRecord) are loaded by Initializer#require_frameworks. The actual frameworks that are loaded is configurable in environment.rb. So ActiveRecord is explicitely required, but all its various components are autoloaded. > And just out of curiosity, what is reloaded in development mode and > how does it occur? Where is the code that does the reloading process? Loading and reloading is handled by ActiveSupport::Dependencies, which hooks into const_missing for all classes and modules. When cache_classes is set to false, everything that is autoloaded is unloaded at the end of each request by the Dispatcher. The exception is any file that is found in the load_once_paths, which generally contains the lib folder for all plugins. The load_once_paths, as well as the load_paths, are configurable in environment.rb. To be honest, once you know where to look, it's relatively easy to figure out, as the code is pretty well commented. The trick is to know where to look, and this is where a high level overview would be helpful. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" 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-core?hl=en -~----------~----~----~----~------~----~------~--~---
