Cache expensive options_text call

This commit is contained in:
Rohan Mitchell
2014-05-08 15:51:48 +10:00
parent 64c94793e4
commit 967d4c81ab

View File

@@ -1,4 +1,9 @@
object @variant
attributes :id
node( :unit_text ) { |v| v.product.name + (v.options_text.empty? ? "" : ": " + v.options_text) }
node( :unit_text ) do |v|
options_text = v.options_text
v.product.name + (options_text.empty? ? "" : ": #{options_text}")
end
node( :unit_value ) { |v| v.unit_value }