activerecord-mysql-uuid-column 0.1.1 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 438e4ba56f4218968d31d57101e6a44f78a58ccc
4
- data.tar.gz: 5126bd415de369e7abfad67ac0599b39c1997dd4
2
+ SHA256:
3
+ metadata.gz: 3a01a97a93e55b325b513f9d6133ea26e996b9c81f18739a335f761266acfbb5
4
+ data.tar.gz: b3bae23e8b491eeac66dd0d56b269c437b794c9bfc8607e2a5a85964b443fc0b
5
5
  SHA512:
6
- metadata.gz: '09b9e49f9b6a05bf50616d135155efe4d080eb36daafd3893c9d9657c035e860d7b5652f3f3c70207cb3f87a88503258d551c075deff5b9f271ca1de8632695a'
7
- data.tar.gz: f626a8d982805e1dda2f9efe0ac5482d13b1ccad2d6123473d768a96211c81e08cfbe1521a2dcfb72adacf1382ce9ce07831d738be0351fb3fc2fc04a4a0a3bb
6
+ metadata.gz: af8645386829d9945dfbeaa0fe9ac2030fbead5dcd70cb7d9fcef18053e66e309a1adc7c3d5c4aca0df9a39e348834abc830750dbb50ff8df9c483a19a5c9e54
7
+ data.tar.gz: 7ff8f4beed505f51b0fec3913a2552009d54da3adf772ae103c3716ca14b72885bfbd0dbb3ad0ec3fadb2feae5e98e3d6954a8085de433173c2790ac85a1a00d
@@ -2,8 +2,26 @@ sudo: false
2
2
  cache: bundler
3
3
  language: ruby
4
4
  rvm:
5
- - 2.2.6
6
- - 2.3.3
7
- - 2.4.0
5
+ - 2.2.10
6
+ - 2.3.8
7
+ - 2.4.5
8
+ - 2.5.3
8
9
  - ruby-head
10
+
11
+ matrix:
12
+ allow_failures:
13
+ - rvm: ruby-head
14
+ - gemfile: gemfiles/Gemfile.rails-4.2.x # Unsupported
15
+ exclude:
16
+ - rvm: 2.2.10
17
+ gemfile: gemfiles/Gemfile.rails-edge
18
+ - rvm: 2.3.8
19
+ gemfile: gemfiles/Gemfile.rails-edge
20
+
9
21
  before_install: gem install bundler
22
+ gemfile:
23
+ - gemfiles/Gemfile.rails-4.2.x
24
+ - gemfiles/Gemfile.rails-5.0.x
25
+ - gemfiles/Gemfile.rails-5.1.x
26
+ - gemfiles/Gemfile.rails-5.2.x
27
+ - gemfiles/Gemfile.rails-edge
data/README.md CHANGED
@@ -26,7 +26,7 @@ Or install it yourself as:
26
26
 
27
27
  ## Usage
28
28
 
29
- # Regular MySQL ActiveRecord config
29
+ Regular MySQL ActiveRecord config
30
30
  ```
31
31
  test:
32
32
  adapter: mysql2
@@ -67,10 +67,16 @@ To install this gem onto your local machine, run `bundle exec rake install`. To
67
67
  Bug reports and pull requests are welcome on GitHub at https://github.com/mathieujobin/activerecord-mysql-uuid-column. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
68
68
 
69
69
  ## Online API Doc
70
- http://www.rubydoc.info/gems/activerecord-mysql-uuid-column/0.1.0
70
+ * http://www.rubydoc.info/gems/activerecord-mysql-uuid-column/0.2.0
71
71
 
72
72
  ## On libraries.io
73
- https://libraries.io/rubygems/activerecord-mysql-uuid-column
73
+ * https://libraries.io/rubygems/activerecord-mysql-uuid-column
74
+
75
+ ## Resources
76
+ * https://christoph.luppri.ch/articles/2017/01/07/adding-custom-types-to-your-activerecord-models-with-the-attributes-api/
77
+ * https://karolgalanciak.com/blog/2016/12/04/introduction-to-activerecord-and-activemodel-attributes-api/
78
+ * https://blog.metova.com/rails-5-attributes-api
79
+ * https://gorails.com/episodes/virtual-attributes-and-rails-5-attribute-api
74
80
 
75
81
  ## License
76
82
 
@@ -25,7 +25,7 @@ Gem::Specification.new do |spec|
25
25
  spec.add_development_dependency "rake", "~> 10.0"
26
26
  spec.add_development_dependency "rspec", "~> 3.0"
27
27
  spec.add_development_dependency "byebug", '~> 3'
28
- spec.add_development_dependency "looksee", '~> 4'
28
+ spec.add_development_dependency "looksee", '~> 4' if RUBY_VERSION < '2.6.0'
29
29
  spec.add_development_dependency "codecov", '~> 0'
30
30
  spec.add_dependency "activerecord", ">= 5", "< 6"
31
31
  spec.add_dependency "mysql2", "~> 0.4.4"
@@ -0,0 +1,5 @@
1
+ source 'https://rubygems.org'
2
+
3
+ gemspec path: '../'
4
+
5
+ gem 'activerecord', '~> 4.2.0'
@@ -0,0 +1,5 @@
1
+ source 'https://rubygems.org'
2
+
3
+ gemspec path: '../'
4
+
5
+ gem 'activerecord', '~> 5.0.0'
@@ -0,0 +1,5 @@
1
+ source 'https://rubygems.org'
2
+
3
+ gemspec path: '../'
4
+
5
+ gem 'activerecord', '~> 5.1.0'
@@ -0,0 +1,5 @@
1
+ source 'https://rubygems.org'
2
+
3
+ gemspec path: '../'
4
+
5
+ gem 'activerecord', '~> 5.2.0'
@@ -0,0 +1,5 @@
1
+ source 'https://rubygems.org'
2
+
3
+ gemspec path: '../'
4
+
5
+ gem 'activerecord', github: 'rails/rails'
@@ -30,11 +30,11 @@ module ActiveRecord
30
30
  def assert_valid_value(value)
31
31
  case value.class
32
32
  when String, ActiveSupport::ToJsonWithActiveSupportEncoder
33
- if value.downcase.gsub(/[^a-f0-9]/, '').size == 32
33
+ if value.blank? || value.to_s.downcase.gsub(/[^a-f0-9]/, '').size == 32
34
34
  value
35
35
  else
36
36
  raise SerializationTypeMismatch,
37
- "Invalid String uuid #{value}."
37
+ "Invalid String uuid '#{value}'"
38
38
  end
39
39
  else
40
40
  raise SerializationTypeMismatch,
@@ -48,10 +48,13 @@ module ActiveRecord
48
48
  end
49
49
 
50
50
  def self.from_uuid_string(uuid)
51
+ return nil if uuid.nil?
51
52
  new(uuid, uuid.downcase.gsub(/[^a-f0-9]/, ''))
52
53
  end
53
54
 
54
55
  def self.from_database(value)
56
+ return value if value.is_a? Data
57
+
55
58
  storage_format = value.unpack('H*').first.rjust(32, '0')
56
59
  new(
57
60
  storage_format.gsub(/^(.{8})(.{4})(.{4})(.{4})(.{12})$/, '\1-\2-\3-\4-\5'),
@@ -1,7 +1,7 @@
1
1
  module ActiveRecord
2
2
  module Mysql
3
3
  module UuidColumn
4
- VERSION = "0.1.1"
4
+ VERSION = '0.2.0'
5
5
  end
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: activerecord-mysql-uuid-column
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mathieu Jobin
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2017-02-21 00:00:00.000000000 Z
11
+ date: 2018-11-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -147,6 +147,11 @@ files:
147
147
  - activerecord-mysql-uuid-column.gemspec
148
148
  - bin/console
149
149
  - bin/setup
150
+ - gemfiles/Gemfile.rails-4.2.x
151
+ - gemfiles/Gemfile.rails-5.0.x
152
+ - gemfiles/Gemfile.rails-5.1.x
153
+ - gemfiles/Gemfile.rails-5.2.x
154
+ - gemfiles/Gemfile.rails-edge
150
155
  - lib/active_record-mysql-uuid_column.rb
151
156
  - lib/active_record-mysql-uuid_column/migration_column.rb
152
157
  - lib/active_record-mysql-uuid_column/mysql2_adapter_monkey_patch.rb
@@ -172,7 +177,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
172
177
  version: '0'
173
178
  requirements: []
174
179
  rubyforge_project:
175
- rubygems_version: 2.5.2
180
+ rubygems_version: 2.7.8
176
181
  signing_key:
177
182
  specification_version: 4
178
183
  summary: Adds a :uuid column to ActiveRecord MySQL2 Adapter. Store UUIDs as 16 bytes