gravis-acts_as_archive 0.2.8 → 0.2.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -43,7 +43,7 @@ module ActsAsArchive
43
43
  indexes = archive_table_indexed_columns
44
44
 
45
45
  (archive_indexes - indexes).each do |index|
46
- connection.add_index("archived_#{table_name}", index) if table_has_columns(index)
46
+ connection.add_index("archived_#{table_name}", index, :name => index_name_for(table_name, index)) if table_has_columns(index)
47
47
  end
48
48
  (indexes - archive_indexes).each do |index|
49
49
  connection.remove_index("archived_#{table_name}", index) if table_has_columns(index)
@@ -86,6 +86,10 @@ module ActsAsArchive
86
86
  def table_has_columns(columns)
87
87
  !Array(columns).select {|current_column| self::Archive.column_names.include?(current_column.to_s)}.empty?
88
88
  end
89
+
90
+ def index_name_for(table_name, index)
91
+ "index_by_#{Array(index).join("_and_")}".to_sym if "index_archived_#{table_name}_on_#{Array(index).join("_and_")}".length > 63
92
+ end
89
93
  end
90
94
 
91
95
  module InstanceMethods
data/require.rb CHANGED
@@ -17,7 +17,7 @@ Require do
17
17
  name 'gravis-acts_as_archive'
18
18
  homepage "http://github.com/gravis/#{name}"
19
19
  summary "Don't delete your records, move them to a different table"
20
- version '0.2.8'
20
+ version '0.2.9'
21
21
  end
22
22
 
23
23
  lib do
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gravis-acts_as_archive
3
3
  version: !ruby/object:Gem::Version
4
- hash: 7
4
+ hash: 5
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 2
9
- - 8
10
- version: 0.2.8
9
+ - 9
10
+ version: 0.2.9
11
11
  platform: ruby
12
12
  authors:
13
13
  - Winton Welsh