lib/dining-table/columns/column.rb in dining-table-0.1.0 vs lib/dining-table/columns/column.rb in dining-table-0.2.0
- old
+ new
@@ -15,19 +15,19 @@
def value(object)
if block
block.call(object, self)
else
- object.send(name).try(:to_s) if object.respond_to?(name)
+ object.send(name) if object.respond_to?(name)
end
end
def header
@header ||= begin
label = determine_label(:header)
return label if label
- object_class = table.collection.first.try(:class)
+ object_class = table.collection.first.class if table.collection.first
object_class.human_attribute_name( name ) if object_class && object_class.respond_to?( :human_attribute_name )
end
end
def footer
@@ -42,10 +42,11 @@
def determine_label( name )
if options[ name ]
label_ = options[ name ]
label_ = label_.call if label_.respond_to?(:call)
- return label_.try(:to_s)
+ label_ = label_.to_s if label_.respond_to?(:to_s)
+ return label_
end
end
end
\ No newline at end of file