lib/active_admin/views/components/attributes_table.rb in activeadmin-0.4.4 vs lib/active_admin/views/components/attributes_table.rb in activeadmin-0.5.0.pre
- old
+ new
@@ -33,11 +33,15 @@
def default_id_for_prefix
'attributes_table'
end
def header_content_for(attr)
- @record.class.respond_to?(:human_attribute_name) ? @record.class.human_attribute_name(attr).titleize : attr.to_s.titleize
+ if @record.class.respond_to?(:human_attribute_name)
+ @record.class.human_attribute_name(attr, :default => attr.to_s.titleize)
+ else
+ attr.to_s.titleize
+ end
end
def empty_value
span I18n.t('active_admin.empty'), :class => "empty"
end
@@ -48,10 +52,10 @@
attr_or_proc.call(@record)
else
content_for_attribute(attr_or_proc)
end
value = pretty_format(value)
- value == "" || value == nil ? empty_value : value
+ value == "" || value.nil? ? empty_value : value
end
def content_for_attribute(attr)
if attr.to_s =~ /^([\w]+)_id$/ && @record.respond_to?($1.to_sym)
content_for_attribute($1)