lib/formotion/section/section.rb in formotion-0.5.1 vs lib/formotion/section/section.rb in formotion-1.0

- old
+ new

@@ -49,10 +49,12 @@ if hash.class == Hash row = Formotion::Row.new(hash) end row.section = self row.index = self.rows.count + # dont move to after the appending. + row.after_create self.rows << row row end ######################### @@ -98,11 +100,17 @@ end nil end + def refresh_row_indexes + rows.each_with_index do |row, index| + row.index = index + end + end + ######################### - # Retreiving data + # Retreiving data def to_hash h = super h[:rows] = self.rows.collect {|row| row.to_hash} h end \ No newline at end of file