lib/table_for/base.rb in table-for-3.4.1 vs lib/table_for/base.rb in table-for-3.5.0
- old
+ new
@@ -6,10 +6,14 @@
alias columns queued_blocks
attr_accessor :current_record
alias_method :current_row, :current_record
+ attr_accessor :current_index
+ alias_method :current_row_index, :current_index
+
+
def initialize(view, options={})
super(view, TableFor.config.merge(options))
end
def header(name, options={}, &block)
@@ -90,11 +94,12 @@
else
record.send(column.name)
end
end
- def set_current_record(record)
+ def set_current_record_and_index(record, index)
self.current_record = record
+ self.current_index = index
end
def header_sort_link(column, options={}, &block)
if options[:sortable] && (options[:header] || !column.anonymous)
order = options[:order] ? options[:order].to_s : column.name.to_s