Skip to content
Browse files

Looking at table_name attribute of model when generating versioned ta…

…ble names.
  • Loading branch information...
1 parent b59be91 commit 81604b236839e080f0e3a908f6f6f5db9f8ad6cb @tiss committed
Showing with 2 additions and 1 deletion.
  1. +2 −1 lib/acts_as_versioned.rb
View
3 lib/acts_as_versioned.rb
@@ -175,7 +175,8 @@ def acts_as_versioned(options = {}, &extension)
self.versioned_class_name = options[:class_name] || "Version"
self.versioned_foreign_key = options[:foreign_key] || self.to_s.foreign_key
- self.versioned_table_name = options[:table_name] || "#{table_name_prefix}#{base_class.name.demodulize.underscore}_h#{table_name_suffix}"
+ self.versioned_table_name = options[:table_name] || if self.table_name then "#{table_name}_h" else "#{table_name_prefix}#{base_class.name.demodulize.underscore}_h#{table_name_suffix}" end
+
self.versioned_inheritance_column = options[:inheritance_column] || "versioned_#{inheritance_column}"
self.version_column = options[:version_column] || 'version'
self.deleted_in_original_table_flag = options[:deleted_in_original_table_flag] || 'deleted_in_original_table'

0 comments on commit 81604b2

Please sign in to comment.
Something went wrong with that request. Please try again.