Index: engines/rails_extensions/dependencies.rb =================================================================== --- engines/rails_extensions/dependencies.rb (revision 615) +++ engines/rails_extensions/dependencies.rb (working copy) @@ -98,17 +98,17 @@ # try and load the plugin code first # can't use model, as there's nothing in the name to indicate that the file is a 'model' file # rather than a library or anything else. - ['controller', 'helper'].each do |file_type| + Engines.file_types.each do |file_type| # if we recognise this type # (this regexp splits out the module/filename from any instances of app/#{type}, so that # modules are still respected.) - if file_name =~ /^(.*app\/#{file_type}s\/)?(.*_#{file_type})(\.rb)?$/ + if file_name =~ /^(.*app\/#{file_type.pluralize}\/)?(.*_#{file_type})(\.rb)?$/ base_name = $2 # ... go through the plugins from first started to last, so that # code with a high precedence (started later) will override lower precedence # implementations Rails.plugins.each do |plugin| - plugin_file_name = File.expand_path(File.join(plugin.root, 'app', "#{file_type}s", base_name)) + plugin_file_name = File.expand_path(File.join(plugin.root, 'app', file_type.pluralize, base_name)) logger.debug("checking plugin '#{plugin.name}' for '#{base_name}'") if File.file?("#{plugin_file_name}.rb") logger.debug("==> loading from plugin '#{plugin.name}'") @@ -123,7 +123,7 @@ logger.debug("loading from application disabled.") else # Ensure we are only loading from the /app directory at this point - app_file_name = File.join(RAILS_ROOT, 'app', "#{file_type}s", "#{base_name}") + app_file_name = File.join(RAILS_ROOT, 'app', file_type.pluralize, "#{base_name}") if File.file?("#{app_file_name}.rb") logger.debug("loading from application: #{base_name}") file_loaded = true if require_or_load_without_engine_additions(app_file_name, const_path) @@ -140,4 +140,4 @@ end end -::Dependencies.send(:include, Engines::RailsExtensions::Dependencies) \ No newline at end of file +::Dependencies.send(:include, Engines::RailsExtensions::Dependencies) Index: engines.rb =================================================================== --- engines.rb (revision 615) +++ engines.rb (working copy) @@ -84,6 +84,10 @@ # A reference to the current Rails::Initializer instance mattr_accessor :rails_initializer + # The types of files that can be auto-loaded. Classes are expected to end + # with this name and files should end with an underscore and this name + mattr_accessor :file_types + self.file_types = ['controller', 'helper'] #-- # These attributes control the behaviour of the engines extensions @@ -320,4 +324,4 @@ end end end -end \ No newline at end of file +end