lib/mass_insert/adapters/helpers/sanitizer.rb in mass_insert-0.0.2 vs lib/mass_insert/adapters/helpers/sanitizer.rb in mass_insert-0.0.3
- old
+ new
@@ -1,9 +1,15 @@
module MassInsert
module Adapters
module Helpers
module Sanitizer
+ # Returns an array with the column names in the database table like
+ # a symbols.
+ def table_columns
+ class_name.column_names.map(&:to_sym)
+ end
+
# Update the array with the columns names according to the options
# and prepare the columns array with only valid columns.
def sanitized_columns
columns = table_columns
columns.delete(primary_key) if primary_key_mode == :auto