annotaterb 4.9.0 → 4.10.1

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: '09caaf3fa0cb79967a6273386ea6e181e6f22c614ea2e43da32b67abe877cf95'
4
- data.tar.gz: a0181d18310997f66cfb79f3e0d3fdb030708ff55c7492f2821d9024126c3f55
3
+ metadata.gz: 3439937ec29e9b23e7902464eab521443e5171b74cfa386bfc0f4a163eaf2ea3
4
+ data.tar.gz: de7e55a701dc842603467c64576f005c93dee653c3876baa0603906c380efaf7
5
5
  SHA512:
6
- metadata.gz: 5be5ad218586f3a24854edc995ddaf3334507a46c54bfa28325e71706a502a2ce1ca5b8aa53822cf40d51724f16cb9086ea480e61aba7954e916c270484763d5
7
- data.tar.gz: 9ab288486df138231ad168161238e08442b9b80e7b6f06adc21266d0ce002116bf7035313213e6a2db7df743e5f731e0ef2b18df43993837aa4debbf0f9137fd
6
+ metadata.gz: 69243cd57c5c6f284cf06a12465cdfd5fc1bf98c5802e89e7bc44a1e9a7f1e3bc63f2af96dab36aae68406d97a4978e16213c7a63c72e902b33ada3a284a512d
7
+ data.tar.gz: 96680dd592b3d95825d657af8393b740119920907804f363b179f0199010ed11b03f89461720c099292ca70b71d85acca0005e8c913a8ce88b47e58667c3ca78
data/CHANGELOG.md CHANGED
@@ -1,5 +1,37 @@
1
1
  # Changelog
2
2
 
3
+ ## [v4.10.0](https://github.com/drwl/annotaterb/tree/v4.10.0) (2024-06-28)
4
+
5
+ [Full Changelog](https://github.com/drwl/annotaterb/compare/v4.9.0...v4.10.0)
6
+
7
+ **Closed issues:**
8
+
9
+ - Feature Request: add support for arrays when using StoreModel [\#125](https://github.com/drwl/annotaterb/issues/125)
10
+ - Error on composite foreign key constraints [\#121](https://github.com/drwl/annotaterb/issues/121)
11
+
12
+ **Merged pull requests:**
13
+
14
+ - Bump version to v4.10.0 [\#128](https://github.com/drwl/annotaterb/pull/128) ([drwl](https://github.com/drwl))
15
+ - Support composite foreign keys [\#126](https://github.com/drwl/annotaterb/pull/126) ([drwl](https://github.com/drwl))
16
+ - Add files to improve other's ability to help the project [\#123](https://github.com/drwl/annotaterb/pull/123) ([drwl](https://github.com/drwl))
17
+ - Add database and adapter to issue template [\#122](https://github.com/drwl/annotaterb/pull/122) ([drwl](https://github.com/drwl))
18
+ - Generate changelog for v4.9.0 [\#120](https://github.com/drwl/annotaterb/pull/120) ([drwl](https://github.com/drwl))
19
+
20
+ ## [v4.9.0](https://github.com/drwl/annotaterb/tree/v4.9.0) (2024-05-29)
21
+
22
+ [Full Changelog](https://github.com/drwl/annotaterb/compare/v4.8.0...v4.9.0)
23
+
24
+ **Closed issues:**
25
+
26
+ - Duplicate content in fixtures when annotating models [\#108](https://github.com/drwl/annotaterb/issues/108)
27
+ - Cannot exclude annotations from serializer specs [\#103](https://github.com/drwl/annotaterb/issues/103)
28
+
29
+ **Merged pull requests:**
30
+
31
+ - Bump version to v4.9.0 [\#119](https://github.com/drwl/annotaterb/pull/119) ([drwl](https://github.com/drwl))
32
+ - Add support for `NOT VALID` constraints [\#118](https://github.com/drwl/annotaterb/pull/118) ([gmcabrita](https://github.com/gmcabrita))
33
+ - Generate changelog for v4.8.0 [\#116](https://github.com/drwl/annotaterb/pull/116) ([drwl](https://github.com/drwl))
34
+
3
35
  ## [v4.8.0](https://github.com/drwl/annotaterb/tree/v4.8.0) (2024-05-14)
4
36
 
5
37
  [Full Changelog](https://github.com/drwl/annotaterb/compare/v4.7.1...v4.8.0)
data/VERSION CHANGED
@@ -1 +1 @@
1
- 4.9.0
1
+ 4.10.1
@@ -23,8 +23,8 @@ module AnnotateRb
23
23
  return false if !klass_is_a_class
24
24
 
25
25
  klass_inherits_active_record_base = klass < ActiveRecord::Base
26
- klass_is_not_abstract = klass.respond_to?(:abstract_class) && !klass.abstract_class?
27
- klass_table_exists = klass.respond_to?(:abstract_class) && klass.table_exists?
26
+ klass_is_not_abstract = klass.respond_to?(:abstract_class?) && !klass.abstract_class?
27
+ klass_table_exists = klass.respond_to?(:table_exists?) && klass.table_exists?
28
28
 
29
29
  not_sure_this_conditional = (!@options[:exclude_sti_subclasses] || !(klass.superclass < ActiveRecord::Base && klass.table_name == klass.superclass.table_name))
30
30
 
@@ -23,14 +23,19 @@ module AnnotateRb
23
23
  return "" if foreign_keys.empty?
24
24
 
25
25
  format_name = lambda do |fk|
26
- return fk.options[:column] if fk.name.blank?
26
+ return fk.column if fk.name.blank?
27
27
 
28
28
  @options[:show_complete_foreign_keys] ? fk.name : fk.name.gsub(/(?<=^fk_rails_)[0-9a-f]{10}$/, "...")
29
29
  end
30
30
 
31
31
  max_size = foreign_keys.map(&format_name).map(&:size).max + 1
32
- foreign_keys.sort_by { |fk| [format_name.call(fk), fk.column] }.each do |fk|
33
- ref_info = "#{fk.column} => #{fk.to_table}.#{fk.primary_key}"
32
+ foreign_keys.sort_by { |fk| [format_name.call(fk), stringify_columns(fk.column)] }.each do |fk|
33
+ ref_info = if fk.column.is_a?(Array) # Composite foreign key using multiple columns
34
+ "#{stringify_columns(fk.column)} => #{fk.to_table}#{stringify_columns(fk.primary_key)}"
35
+ else
36
+ "#{fk.column} => #{fk.to_table}.#{fk.primary_key}"
37
+ end
38
+
34
39
  constraints_info = ""
35
40
  constraints_info += "ON DELETE => #{fk.on_delete} " if fk.on_delete
36
41
  constraints_info += "ON UPDATE => #{fk.on_update} " if fk.on_update
@@ -51,6 +56,13 @@ module AnnotateRb
51
56
 
52
57
  fk_info
53
58
  end
59
+
60
+ private
61
+
62
+ # The fk columns might be composite keys, so format them into a string for the annotation
63
+ def stringify_columns(columns)
64
+ columns.is_a?(Array) ? "[#{columns.join(", ")}]" : columns
65
+ end
54
66
  end
55
67
  end
56
68
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: annotaterb
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.9.0
4
+ version: 4.10.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andrew W. Lee
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2024-05-29 00:00:00.000000000 Z
11
+ date: 2024-07-07 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: Annotates Rails/ActiveRecord Models, routes, fixtures, and others based
14
14
  on the database schema.