comee_core 0.1.55 → 0.1.56
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/controllers/comee/core/units_controller.rb +1 -1
- data/app/models/comee/core/unit.rb +8 -0
- data/app/serializers/comee/core/unit_serializer.rb +1 -1
- data/db/migrate/20230727153013_create_comee_core_units.rb +1 -0
- data/lib/comee/core/version.rb +1 -1
- data/spec/factories/comee/core/units.rb +1 -0
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ead330a4756361db4ef55e9a2716c50fc103c78c17cc18a197e42b1363ce4d4a
|
4
|
+
data.tar.gz: 4f88d44825eccafe77978ae5e71906af4afe657955fc20ead6cde17e035eab8c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9a217c3a5f68e644bde348dff1821170f087f24a4b652f28e840de2ed1c52dd4daf581d837e2e359b014f75842652078146087ad10fcd41beead9896e42f34ca
|
7
|
+
data.tar.gz: 713f0e53ba812000b184a81c55c04e8b83b3977397906718c8adc8970de5463c0706a4884942ec95357353f6edac3bc7a431f4bea81a099851aca1ff39730ad2
|
@@ -1,10 +1,18 @@
|
|
1
1
|
module Comee
|
2
2
|
module Core
|
3
3
|
class Unit < ApplicationRecord
|
4
|
+
before_save :downcase_aliases
|
5
|
+
|
4
6
|
enum :unit_type, {weight: 0, volume: 1, item: 2}
|
5
7
|
|
6
8
|
validates :code, presence: true, uniqueness: true
|
7
9
|
validates :name, presence: true
|
10
|
+
|
11
|
+
def downcase_aliases
|
12
|
+
return if aliases.count.zero? || aliases.nil?
|
13
|
+
|
14
|
+
aliases.map(&:downcase!)
|
15
|
+
end
|
8
16
|
end
|
9
17
|
end
|
10
18
|
end
|
data/lib/comee/core/version.rb
CHANGED