activerecord-mysql-enum 0.1.0 → 0.1.4.pre.1

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
2
  SHA1:
3
- metadata.gz: 731be1b698830840960df66c633230838cc5a12a
4
- data.tar.gz: 0546d381f19f95569f6b44aa9c63ec2e5aa53cf1
3
+ metadata.gz: 65f091ec84ca56cc57327fc3ed102b44d5144186
4
+ data.tar.gz: 93580fa1fe7b02bb89852aad0fe8f78114934bd4
5
5
  SHA512:
6
- metadata.gz: 03b00f78790935c06f5fca8979e25618a73e81a9e7f5c8c3bd7745834054b63303414769dc17374e1f482ec5aeaa2b30b470ec03eafe943f8b4046614cd3ae21
7
- data.tar.gz: 94b3cf153dfc170e391914761b6286002806ff405bdaabf9877e57294218363714f38f1af9d32b6696d6a205a469e22aef969183888799d072aa74d108a1f61a
6
+ metadata.gz: 51727f428f088f3a4984566760a0634eeec7651982b8e587f8ca347e29a23edff865922d92c5c3fe68e359976692d1aa47d8921e6fe78cef756d48636e77ad9d
7
+ data.tar.gz: bf39dcfcfa03f9d0ead9b94da25fa762f1b2c438abea2f319504fbc43d0657d3f7fd33c9086518d56887a98eeca8c482181f709eef04045403e033793b4a1798
@@ -4,6 +4,23 @@ Inspired by [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
4
4
 
5
5
  Note: this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
6
6
 
7
+ ## [0.1.4] - Unreleased
8
+ ### Fixed
9
+ - Fixed bug in `mysql_adapter` where optional arguments being passed to `type_to_sql` would cause
10
+ an unexpected error
11
+
12
+ ## [0.1.3] - 2020-08-19
13
+ ### Changed
14
+ - refactor mysql adapter
15
+
16
+ ## [0.1.2] - 2020-08-18
17
+ ### Changed
18
+ - fixed frozen string to reassign value instead of append
19
+
20
+ ## [0.1.1] - 2020-08-18
21
+ ### Added
22
+ - extended activerecord dependency to '>= 4.2', '< 7'
23
+
7
24
  ## [0.1.0] - 2020-08-17
8
25
  ### Added
9
26
  - Backwards compatibility with Rails 4
@@ -11,4 +28,8 @@ Note: this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0
11
28
  ### Changed
12
29
  - Renamed the gem from `enum_column3` to `activerecord-mysql-enum`
13
30
 
14
- [0.1.0]: https://github.com/Invoca/activerecord-mysql-enum/tree/0.1.0
31
+ [0.1.4]: https://github.com/Invoca/activerecord-mysql-enum/compare/v0.1.3...v0.1.4
32
+ [0.1.3]: https://github.com/Invoca/activerecord-mysql-enum/compare/v0.1.2...v0.1.3
33
+ [0.1.2]: https://github.com/Invoca/activerecord-mysql-enum/compare/v0.1.1...v0.1.2
34
+ [0.1.1]: https://github.com/Invoca/activerecord-mysql-enum/compare/v0.1.0...v0.1.1
35
+ [0.1.0]: https://github.com/Invoca/activerecord-mysql-enum/tree/v0.1.0
@@ -1,8 +1,8 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- activerecord-mysql-enum (0.1.0)
5
- activerecord (>= 4.2, < 6)
4
+ activerecord-mysql-enum (0.1.4.pre.1)
5
+ activerecord (>= 4.2, < 7)
6
6
 
7
7
  GEM
8
8
  remote: https://rubygems.org/
data/README.md CHANGED
@@ -17,7 +17,7 @@ Currently this has been manually tested with Rails version 4 and 5, and works wi
17
17
  ## Installation
18
18
  In your `Gemfile` add the following snippet
19
19
  ```ruby
20
- gem 'activerecord-mysql-enum', '~> 0.1', require: 'active_support/mysql/enum'
20
+ gem 'activerecord-mysql-enum', '~> 0.1', require: 'active_record/mysql/enum'
21
21
  ```
22
22
 
23
23
  ## Usage
@@ -28,5 +28,5 @@ Gem::Specification.new do |spec|
28
28
  end
29
29
  spec.require_paths = ["lib"]
30
30
 
31
- spec.add_dependency 'activerecord', '>= 4.2', '< 6'
31
+ spec.add_dependency 'activerecord', '>= 4.2', '< 7'
32
32
  end
@@ -28,29 +28,37 @@ module ActiveRecord
28
28
  #
29
29
  # will generate enum('a', 'b', 'c') for :limit => [:a, :b, :c]
30
30
  if Rails::VERSION::MAJOR < 5
31
- def type_to_sql(type, limit = nil, precision = nil, scale = nil, unsigned = nil, **_options) # :nodoc:
31
+ def type_to_sql(type, limit = nil, precision = nil, scale = nil, **_options)
32
32
  if type.to_s == 'enum'
33
- native = native_database_types[type]
34
- column_type_sql = (native || {})[:name] || 'enum'
33
+ column_type_sql =
34
+ if (native_database_type = native_database_types[type])
35
+ native_database_type[:name]
36
+ else
37
+ 'enum'
38
+ end
35
39
 
36
- column_type_sql << "(#{limit.map { |v| quote(v) }.join(',')})"
40
+ quoted_values = limit.map { |v| quote(v) }.join(',')
37
41
 
38
- column_type_sql
42
+ "#{column_type_sql}(#{quoted_values})"
39
43
  else
40
- super(type, limit, precision, scale, unsigned)
44
+ super
41
45
  end
42
46
  end
43
47
  else
44
48
  def type_to_sql(type, limit: nil, precision: nil, scale: nil, unsigned: nil, **_options) # :nodoc:
45
49
  if type.to_s == 'enum'
46
- native = native_database_types[type]
47
- column_type_sql = (native || {})[:name] || 'enum'
50
+ column_type_sql =
51
+ if (native_database_type = native_database_types[type])
52
+ native_database_type[:name]
53
+ else
54
+ 'enum'
55
+ end
48
56
 
49
- column_type_sql << "(#{limit.map { |v| quote(v) }.join(',')})"
57
+ quoted_values = limit.map { |v| quote(v) }.join(',')
50
58
 
51
- column_type_sql
59
+ "#{column_type_sql}(#{quoted_values})"
52
60
  else
53
- super(type, limit: limit, precision: precision, scale: scale, unsigned: unsigned)
61
+ super
54
62
  end
55
63
  end
56
64
  end
@@ -3,7 +3,7 @@
3
3
  module ActiveRecord
4
4
  module Mysql
5
5
  module Enum
6
- VERSION = "0.1.0"
6
+ VERSION = "0.1.4.pre.1"
7
7
  end
8
8
  end
9
9
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: activerecord-mysql-enum
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.4.pre.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nick Pohodnya
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2020-08-17 00:00:00.000000000 Z
12
+ date: 2020-08-20 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: activerecord
@@ -20,7 +20,7 @@ dependencies:
20
20
  version: '4.2'
21
21
  - - "<"
22
22
  - !ruby/object:Gem::Version
23
- version: '6'
23
+ version: '7'
24
24
  type: :runtime
25
25
  prerelease: false
26
26
  version_requirements: !ruby/object:Gem::Requirement
@@ -30,7 +30,7 @@ dependencies:
30
30
  version: '4.2'
31
31
  - - "<"
32
32
  - !ruby/object:Gem::Version
33
- version: '6'
33
+ version: '7'
34
34
  description: Enable enum type for the MySQL Adapter in ActiveRecord
35
35
  email:
36
36
  - development@invoca.com
@@ -76,9 +76,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
76
76
  version: '0'
77
77
  required_rubygems_version: !ruby/object:Gem::Requirement
78
78
  requirements:
79
- - - ">="
79
+ - - ">"
80
80
  - !ruby/object:Gem::Version
81
- version: '0'
81
+ version: 1.3.1
82
82
  requirements: []
83
83
  rubyforge_project:
84
84
  rubygems_version: 2.6.13