active_fields 0.1.0 → 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (78) hide show
  1. checksums.yaml +4 -4
  2. data/.rspec +0 -1
  3. data/.rubocop.yml +3 -15
  4. data/CHANGELOG.md +19 -0
  5. data/README.md +633 -0
  6. data/Rakefile +7 -0
  7. data/app/models/active_fields/application_record.rb +7 -0
  8. data/app/models/active_fields/field/base.rb +17 -0
  9. data/{lib/active_fields/models → app/models/active_fields}/field/boolean.rb +14 -9
  10. data/{lib/active_fields/models → app/models/active_fields}/field/date.rb +16 -12
  11. data/app/models/active_fields/field/date_array.rb +36 -0
  12. data/app/models/active_fields/field/date_time.rb +77 -0
  13. data/app/models/active_fields/field/date_time_array.rb +61 -0
  14. data/app/models/active_fields/field/decimal.rb +75 -0
  15. data/app/models/active_fields/field/decimal_array.rb +59 -0
  16. data/{lib/active_fields/models → app/models/active_fields}/field/enum.rb +34 -17
  17. data/app/models/active_fields/field/enum_array.rb +64 -0
  18. data/{lib/active_fields/models → app/models/active_fields}/field/integer.rb +16 -12
  19. data/app/models/active_fields/field/integer_array.rb +36 -0
  20. data/{lib/active_fields/models → app/models/active_fields}/field/text.rb +16 -12
  21. data/app/models/active_fields/field/text_array.rb +39 -0
  22. data/app/models/active_fields/value.rb +15 -0
  23. data/app/models/concerns/active_fields/customizable_concern.rb +94 -0
  24. data/app/models/concerns/active_fields/field_array_concern.rb +25 -0
  25. data/app/models/concerns/active_fields/field_concern.rb +111 -0
  26. data/app/models/concerns/active_fields/value_concern.rb +83 -0
  27. data/config/routes.rb +4 -0
  28. data/{lib/generators/active_fields/install/templates/create_active_fields_tables.rb.tt → db/migrate/20240229230000_create_active_fields_tables.rb} +8 -6
  29. data/lib/active_fields/casters/base_caster.rb +8 -2
  30. data/lib/active_fields/casters/boolean_caster.rb +0 -2
  31. data/lib/active_fields/casters/date_array_caster.rb +0 -2
  32. data/lib/active_fields/casters/date_caster.rb +8 -8
  33. data/lib/active_fields/casters/date_time_array_caster.rb +19 -0
  34. data/lib/active_fields/casters/date_time_caster.rb +43 -0
  35. data/lib/active_fields/casters/decimal_array_caster.rb +0 -2
  36. data/lib/active_fields/casters/decimal_caster.rb +10 -4
  37. data/lib/active_fields/casters/enum_array_caster.rb +13 -3
  38. data/lib/active_fields/casters/enum_caster.rb +15 -3
  39. data/lib/active_fields/casters/integer_array_caster.rb +0 -2
  40. data/lib/active_fields/casters/integer_caster.rb +2 -4
  41. data/lib/active_fields/casters/text_array_caster.rb +0 -2
  42. data/lib/active_fields/casters/text_caster.rb +0 -2
  43. data/lib/active_fields/config.rb +61 -0
  44. data/lib/active_fields/customizable_config.rb +24 -0
  45. data/lib/active_fields/engine.rb +13 -0
  46. data/lib/active_fields/has_active_fields.rb +19 -0
  47. data/lib/active_fields/validators/base_validator.rb +7 -3
  48. data/lib/active_fields/validators/boolean_validator.rb +2 -4
  49. data/lib/active_fields/validators/date_array_validator.rb +3 -5
  50. data/lib/active_fields/validators/date_time_array_validator.rb +26 -0
  51. data/lib/active_fields/validators/date_time_validator.rb +19 -0
  52. data/lib/active_fields/validators/date_validator.rb +3 -5
  53. data/lib/active_fields/validators/decimal_array_validator.rb +2 -4
  54. data/lib/active_fields/validators/decimal_validator.rb +2 -4
  55. data/lib/active_fields/validators/enum_array_validator.rb +3 -5
  56. data/lib/active_fields/validators/enum_validator.rb +3 -5
  57. data/lib/active_fields/validators/integer_array_validator.rb +2 -4
  58. data/lib/active_fields/validators/integer_validator.rb +2 -4
  59. data/lib/active_fields/validators/text_array_validator.rb +2 -4
  60. data/lib/active_fields/validators/text_validator.rb +2 -4
  61. data/lib/active_fields/version.rb +1 -1
  62. data/lib/active_fields.rb +47 -7
  63. data/lib/generators/active_fields/install/USAGE +1 -1
  64. data/lib/generators/active_fields/install/install_generator.rb +14 -18
  65. data/lib/tasks/active_fields_tasks.rake +6 -0
  66. metadata +49 -36
  67. data/lib/active_fields/models/concerns/concern.rb +0 -16
  68. data/lib/active_fields/models/concerns/customizable.rb +0 -83
  69. data/lib/active_fields/models/concerns/field_concern.rb +0 -79
  70. data/lib/active_fields/models/concerns/value_concern.rb +0 -50
  71. data/lib/active_fields/models/field/date_array.rb +0 -44
  72. data/lib/active_fields/models/field/decimal.rb +0 -48
  73. data/lib/active_fields/models/field/decimal_array.rb +0 -44
  74. data/lib/active_fields/models/field/enum_array.rb +0 -59
  75. data/lib/active_fields/models/field/integer_array.rb +0 -34
  76. data/lib/active_fields/models/field/text_array.rb +0 -35
  77. data/lib/active_fields/models/field.rb +0 -27
  78. data/lib/active_fields/models/value.rb +0 -30
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 81a03041febfec92f7fdbbb6e9f8b9e1f40cc715744467541fbb0c08011f5a22
4
- data.tar.gz: f6d64ed4e8e703c66e0dd7deff7f41c1c8da60b35ff084b1ca8c20986b8776b5
3
+ metadata.gz: e668baeb2df705293feec23b2948fd6ca762bd3e5f6671aec273579133cfb368
4
+ data.tar.gz: a7eac6f5cb2a46e9d246e2d3d8023a9e1995446d92d9c2cf93ab1100f265d283
5
5
  SHA512:
6
- metadata.gz: 660528c8044ef3000116b892cc236de565fe5530f9958b4a0f4ae9c511d2a3c3f4d8944fe6b2894d59f16b6bff6cd529acb6a592100c9e3cc396c0030d2069c6
7
- data.tar.gz: 4843897cd9783e5d5489e0cf8c91d103d3136e23ee754ae447b77705f073e7e35750098a83e713ed77948d164d308eb8a690c206d0d52406c26eba0913817710
6
+ metadata.gz: 1c7007b25907d9f0a25b5ef76bb4b031772a0cdf859243676c242fb57f457dab768b5f629760b68661a3b00aa60601b0bf856911a816313a36a53b74206dbb4b
7
+ data.tar.gz: 83595ef579ea24057de81a0f5b07563eaf77a0e8e2a78da3b30bbf4f0312246c6ca237590f77d279c990c9765f982e8293958b1df73d92996e2f63dc567990c8
data/.rspec CHANGED
@@ -1,2 +1 @@
1
- --color
2
1
  --require spec_helper
data/.rubocop.yml CHANGED
@@ -1,9 +1,10 @@
1
1
  require:
2
+ # - rubocop-factory_bot
2
3
  - rubocop-performance
3
4
  - rubocop-rails
4
5
  - rubocop-rake
5
6
  - rubocop-rspec
6
- - rubocop-factory_bot
7
+ # - rubocop-rspec_rails
7
8
 
8
9
  inherit_gem:
9
10
  rubocop-shopify: rubocop.yml
@@ -13,7 +14,7 @@ AllCops:
13
14
  TargetRailsVersion: 7.1
14
15
  NewCops: enable
15
16
  Exclude:
16
- - "active_fields.gemspec"
17
+ - "spec/dummy/db/schema.rb"
17
18
 
18
19
  Layout/EmptyLinesAroundAccessModifier:
19
20
  EnforcedStyle: around
@@ -45,16 +46,3 @@ RSpec/ContextWording:
45
46
 
46
47
  RSpec/MultipleExpectations:
47
48
  Enabled: false
48
-
49
- Rails/ApplicationRecord:
50
- Enabled: false
51
-
52
- Rails/Date:
53
- Enabled: false
54
-
55
- RSpec/FilePath:
56
- Enabled: false
57
-
58
- RSpec/SpecFilePathFormat:
59
- Enabled: false
60
-
data/CHANGELOG.md CHANGED
@@ -1,4 +1,23 @@
1
1
  ## [Unreleased]
2
+ - Precision configuration for decimal fields
3
+ - Added array field types mix-in `ActiveFields::FieldArrayConcern`
4
+ - Fixed enum types behavior for blank values
5
+ - Dummy app
6
+ - Enhanced values storage format
7
+ - Do not implicitly create _Active Values_ when saving an _Active Field_ or _Customizable_
8
+ - Utilize _ActiveRecord_'s nested attributes feature in _Customizable_ models to manage associated _Active Values_
9
+ - Serialize decimals as strings as _ActiveRecord_ does for JSON columns
10
+ - Added datetime and datetime array field types
11
+ - Added fields configuration DSL
12
+ - Introduced new _Customizable_ setter for _Active Values_ (`active_fields_attributes=`) with a more convenient syntax
13
+ to replace the default setter (`active_values_attributes=`) from Rails nested attributes feature.
14
+
15
+ ## [0.2.0] - 2024-06-13
16
+
17
+ - Rewritten as a Rails plugin!
18
+ - Custom field types support
19
+ - Global configuration options for changing field and value classes
20
+ - Per-model configuration option for enabling specific field types only
2
21
 
3
22
  ## [0.1.0] - 2024-05-19
4
23