lib/action_view/component.rb in actionview-component-1.0.0 vs lib/action_view/component.rb in actionview-component-1.0.1
- old
+ new
@@ -65,11 +65,11 @@
# Compile template to #call instance method, assuming it hasn't been compiled already.
# We could in theory do this on app boot, at least in production environments.
# Right now this just compiles the template the first time the component is rendered.
def compile
- return if @compiled
+ return if @compiled && ActionView::Base.cache_template_loading
class_eval("def call; @output_buffer = ActionView::OutputBuffer.new; #{compiled_template}; end")
@compiled = true
end
@@ -98,10 +98,10 @@
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
raise NotImplementedError.new(
- "Could not find a template for #{self}. Either define a .template method or add a sidecar template file."
+ "Could not find a template file for #{self}."
)
end
sibling_files[0]
end