diff --git a/lib/table_cloth/extensions/row_attributes.rb b/lib/table_cloth/extensions/row_attributes.rb index 8fba9c8..454d634 100644 --- a/lib/table_cloth/extensions/row_attributes.rb +++ b/lib/table_cloth/extensions/row_attributes.rb @@ -21,10 +21,10 @@ def tr_options @tr_options end - def tr_options_for(object) + def tr_options_for(object, view_context) options = tr_options if options.include?(:proc) - result = options[:proc].call(object) || {} + result = options[:proc].call(object, view_context) || {} options.except(:proc).merge(result) else options diff --git a/lib/table_cloth/presenters/default.rb b/lib/table_cloth/presenters/default.rb index ee18d49..2516a70 100644 --- a/lib/table_cloth/presenters/default.rb +++ b/lib/table_cloth/presenters/default.rb @@ -16,7 +16,7 @@ def thead def tbody @tbody ||= ElementFactory::Element.new(:tbody, tag_options(:tbody)).tap do |tbody| - objects.each {|object| tbody << row_for_object(object) } + objects.each {|object| tbody << row_for_object(object, view_context) } end end @@ -32,8 +32,8 @@ def thead_row end end - def row_for_object(object) - tr_options = table.class.tr_options_for(object) + def row_for_object(object, view_context) + tr_options = table.class.tr_options_for(object, view_context) ElementFactory::Element.new(:tr, tag_options(:tr).merge(tr_options)).tap do |row| columns.each do |column|