Nate, Where is service_type.rb located? Also, do you override/add additional load paths in your environment.rb? I'm wondering if the load path for that file is present in $LOAD_PATH, but not Dependencies.load_paths.
-Aaron Nate Wiger wrote: > I'm wondering if I've hit an edge rails bug. I'm using single table > inheritance to map different types of components for a management app. > The inheritance works fine, have the "type" column set, etc. > > The issue I'm hitting is that subclasses don't appear to be > auto-loading missing constants (ie ServiceType to service_type.rb). > This snippet will show the issue: > > ## component_type.rb (single-table inheritance) > # if I uncomment these requires, it works: > #require 'service_type' > #require 'config_file' > class ComponentType < ActiveRecord::Base > def self.load_config_files(service_hint) > service_type = ServiceType.find_by_service_type(service_hint) > ConfigFile.find(:all) > end > end > > ## component_type/medius.rb > class ComponentType::Medius < ComponentType > end > > Then, my controller does this: > > component_type, service_hint = LoaderRule.detect(basename) > component_type.class.load_config_files(service_hint) > > I can get it to work by simply uncommenting the require statements. The > specific error is: > > > uninitialized constant ServiceType > > vendor/rails/activesupport/lib/active_support/dependencies.rb:263:in > `load_missing_constant' > vendor/rails/activesupport/lib/active_support/dependencies.rb:446:in > `const_missing' > vendor/rails/activesupport/lib/active_support/dependencies.rb:458:in > `const_missing' > app/models/component_type.rb:29:in `load_config_files' > app/models/component_type.rb:17:in `load_bundle' > app/models/component_type.rb:14:in `load_bundle' > app/models/loader.rb:69:in `load_file' > app/controllers/loader_controller.rb:4:in `test' --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
