lib/arbre/patches.rb in express_templates-0.7.0 vs lib/arbre/patches.rb in express_templates-0.7.1
- old
+ new
@@ -37,12 +37,24 @@
if current_arbre_element.respond_to?(name)
current_arbre_element.send name, *args, &block
elsif assigns && assigns.has_key?(name)
assigns[name]
elsif helpers.respond_to?(name)
- current_arbre_element.add_child helpers.send(name, *args, &block)
+ helper_method(name, *args, &block)
else
super
+ end
+ end
+
+ # In order to not pollute our templates with helpers. prefixed
+ # everywhere we want to try to distinguish helpers that are almost
+ # always used as parameters to other methods such as path helpers
+ # and not add them as elements
+ def helper_method(name, *args, &block)
+ if name.match /_path$/
+ helpers.send(name, *args, &block)
+ else
+ current_arbre_element.add_child helpers.send(name, *args, &block)
end
end
end
\ No newline at end of file