is_unique 0.1.0 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.0
1
+ 0.1.1
@@ -1,6 +1,6 @@
1
1
  class <%= file_name.camelcase %> < ActiveRecord::Migration
2
2
  def self.up
3
- add_column :<%= table_name %>, :<%= unique_hash_column %>, :string, :limit => 20
3
+ add_column :<%= table_name %>, :<%= unique_hash_column %>, :string, :limit => 40
4
4
  add_index :<%= table_name %>, :<%= unique_hash_column %>
5
5
  # Generate hashes for existing records
6
6
  <%= class_name %>.find_each { |r| r.save(false) }
@@ -5,7 +5,7 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{is_unique}
8
- s.version = "0.1.0"
8
+ s.version = "0.1.1"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Eugene Bolshakov"]
@@ -51,7 +51,7 @@ module IsUnique
51
51
  end
52
52
 
53
53
  def calculate_unique_hash
54
- self.is_unique_hash = Digest::SHA1.digest(
54
+ self.is_unique_hash = Digest::SHA1.hexdigest(
55
55
  unique_attribute_names.inject('') do |r, e|
56
56
  r + "#{e}#{read_attribute_before_type_cast(e)}"
57
57
  end
@@ -14,7 +14,7 @@ def setup_db
14
14
  t.string :name
15
15
  t.float :lat, :lng
16
16
  t.string :alias
17
- t.string :unique_hash, :length => 20
17
+ t.string :unique_hash, :length => 40
18
18
  t.timestamps
19
19
  end
20
20
  end
@@ -25,8 +25,8 @@ describe "A unique model" do
25
25
  )
26
26
  end
27
27
 
28
- it 'should have a 20 characters long unique hash' do
29
- subject.unique_hash.length.should == 20
28
+ it 'should have a 40 characters long unique hash' do
29
+ subject.unique_hash.length.should == 40
30
30
  end
31
31
 
32
32
  it "should not create a new record with the same attributes" do
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 1
8
- - 0
9
- version: 0.1.0
8
+ - 1
9
+ version: 0.1.1
10
10
  platform: ruby
11
11
  authors:
12
12
  - Eugene Bolshakov