Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Fix issues #4 and #9 #10

Open
wants to merge 7 commits into from

1 participant

@cure

The fix for #4 is a hack you may want to improve on; the fix for #9 is more robust.

Thanks,
Ward.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Jun 19, 2011
  1. @cure

    point to correct repo

    cure authored
  2. @cure

    Fix two bugs, as listed in the issues list for technoweenie/acts_as_v…

    cure authored
    …ersioned:
    
      #4
      technoweenie#4
      MySQL decimal Datatype Requires Migration With ":precision => ..."
      to Avoid "No integer type has byte size " Error
    
      #9
      technoweenie#9
      MySQL/PosgreSQL: Index name on table is too long; the limit is 63 characters
Commits on Feb 5, 2012
  1. @cure
  2. @cure
Commits on Jan 26, 2014
  1. @cure
Commits on Mar 27, 2014
  1. @cure

    Change default behavior to *not* remove versioned records when the

    cure authored
    original record is deleted.
  2. @cure

    Bump version to 0.6.3

    cure authored
This page is out of date. Refresh to see the latest.
Showing with 22 additions and 10 deletions.
  1. +13 −7 acts_as_versioned.gemspec
  2. +9 −3 lib/acts_as_versioned.rb
View
20 acts_as_versioned.gemspec
@@ -12,9 +12,9 @@ Gem::Specification.new do |s|
## Leave these as is they will be modified for you by the rake gemspec task.
## If your rubyforge_project name is different, then edit it and comment out
## the sub! line in the Rakefile
- s.name = 'acts_as_versioned'
- s.version = '0.6.0'
- s.date = '2012-03-28'
+ s.name = 'cure_acts_as_versioned'
+ s.version = '0.6.3'
+ s.date = '2014-03-26'
s.rubyforge_project = 'acts_as_versioned'
## Make sure your summary is short. The description may be as long
@@ -25,9 +25,15 @@ Gem::Specification.new do |s|
## List the primary authors. If there are a bunch of authors, it's probably
## better to set the email to an email list or something. If you don't have
## a custom homepage, consider using your GitHub URL or the like.
- s.authors = ["Rick Olson"]
- s.email = 'technoweenie@gmail.com'
- s.homepage = 'http://github.com/technoweenie/acts_as_versioned'
+ # The real primary author is obviously still Rick Olson, but it seems important
+ # to point to the correct github repo and since Rick is not in charge of that
+ # particular repo... Ward, 2011-06-19
+ #s.authors = ["Rick Olson"]
+ #s.email = 'technoweenie@gmail.com'
+ #s.homepage = 'http://github.com/technoweenie/acts_as_versioned'
+ s.authors = ["Ward Vandewege"]
+ s.email = 'ward@jhvc.com'
+ s.homepage = 'http://github.com/cure/acts_as_versioned'
## This gets added to the $LOAD_PATH so that 'lib/NAME.rb' can be required as
## require 'NAME.rb' or'/lib/NAME/file.rb' can be as require 'NAME/file.rb'
@@ -82,4 +88,4 @@ Gem::Specification.new do |s|
## Test files will be grabbed from the file list. Make sure the path glob
## matches what you actually use.
s.test_files = s.files.select { |path| path =~ /^test\/test_.*\.rb/ }
-end
+end
View
12 lib/acts_as_versioned.rb
@@ -180,7 +180,6 @@ def acts_as_versioned(options = {}, &extension)
self.version_association_options = {
:class_name => "#{self.to_s}::#{versioned_class_name}",
:foreign_key => versioned_foreign_key,
- :dependent => :delete_all
}.merge(options[:association_options] || {})
if block_given?
@@ -427,8 +426,13 @@ def create_versioned_table(create_table_options = {})
end
self.versioned_columns.each do |col|
+ limit = col.limit
+ if col.limit == 10 and col.type == :integer
+ # Avoid 'No integer type has byte size 10' under MySQL
+ limit = 8
+ end
self.connection.add_column versioned_table_name, col.name, col.type,
- :limit => col.limit,
+ :limit => limit,
:default => col.default,
:scale => col.scale,
:precision => col.precision
@@ -442,7 +446,9 @@ def create_versioned_table(create_table_options = {})
:precision => type_col.precision
end
- self.connection.add_index versioned_table_name, versioned_foreign_key
+ # Make sure not to create an index that is too long (rails limits index names to 64 characters from version 3.0.3)
+ name = 'index_' + versioned_table_name + '_on_' + versioned_foreign_key
+ self.connection.add_index versioned_table_name, versioned_foreign_key, :name => name[0,63]
end
# Rake migration task to drop the versioned table
Something went wrong with that request. Please try again.