lib/action_view/component/base.rb in actionview-component-1.3.2 vs lib/action_view/component/base.rb in actionview-component-1.3.3

- old
+ new

@@ -115,22 +115,22 @@ def template_file_path raise NotImplementedError.new("#{self} must implement #initialize.") unless self.instance_method(:initialize).owner == self filename = self.instance_method(:initialize).source_location[0] filename_without_extension = filename[0..-(File.extname(filename).length + 1)] - sibling_files = Dir["#{filename_without_extension}.*"] - [filename] + sibling_template_files = Dir["#{filename_without_extension}.????.{#{ActionView::Template.template_handler_extensions.join(',')}}"] - [filename] - if sibling_files.length > 1 + if sibling_template_files.length > 1 raise StandardError.new("More than one template found for #{self}. There can only be one sidecar template file per component.") end - if sibling_files.length == 0 + if sibling_template_files.length == 0 raise NotImplementedError.new( "Could not find a template file for #{self}." ) end - sibling_files[0] + sibling_template_files[0] end end class DummyTemplate attr_reader :source