lib/trestle/table/column.rb in trestle-0.9.6 vs lib/trestle/table/column.rb in trestle-0.9.7
- old
+ new
@@ -106,11 +106,11 @@
end
end
def column_value(instance)
if @column.block
- if defined?(Haml) && Haml::Helpers.block_is_haml?(@column.block)
+ if block_is_legacy_haml?
# In order for table column blocks to work properly within Haml templates,
# the _hamlout local variable needs to be defined in the scope of the block,
# so that the Haml version of the capture method is used. Because we
# evaluate the block using instance_exec, we need to set this up manually.
-> {
@@ -128,9 +128,13 @@
value.is_a?(String) ? buffer : value
end
else
instance.send(@column.field)
end
+ end
+
+ def block_is_legacy_haml?
+ defined?(Haml) && Haml::Helpers.respond_to?(:block_is_haml?) && Haml::Helpers.block_is_haml?(@column.block)
end
end
end
end
end