Object
# File lib/serialization_helper.rb, line 156 def self.after_table(io, table) end
# File lib/serialization_helper.rb, line 144 def self.before_table(io, table) end
# File lib/serialization_helper.rb, line 148 def self.dump(io) tables.each do |table| before_table(io, table) dump_table(io, table) after_table(io, table) end end
# File lib/serialization_helper.rb, line 164 def self.dump_table(io, table) return if table_record_count(table).zero? dump_table_columns(io, table) dump_table_records(io, table) end
# File lib/serialization_helper.rb, line 176 def self.each_table_page(table, records_per_page=1000) total_count = table_record_count(table) pages = (total_count.to_f / records_per_page).ceil - 1 id = table_column_names(table).first boolean_columns = SerializationHelper::Utils.boolean_columns(table) quoted_table_name = SerializationHelper::Utils.quote_table(table) (0..pages).to_a.each do |page| query = Arel::Table.new(table).order(id).skip(records_per_page*page).take(records_per_page).project(Arel.sql('*')) records = ActiveRecord::Base.connection.select_all(query) records = SerializationHelper::Utils.convert_booleans(records, boolean_columns) yield records end end
# File lib/serialization_helper.rb, line 171 def self.table_column_names(table) ActiveRecord::Base.connection.columns(table).map { |c| c.name } end
Generated with the Darkfish Rdoc Generator 2.