tanoshimu_utils 2.0.2 → 2.0.2.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 +4 -4
- data/README.md +17 -2
- data/lib/tanoshimu_utils/concerns/has_translatable_field.rb +2 -2
- data/lib/tanoshimu_utils/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c8d9925646696c1003bfd1550226d5f6b73b75dc66a18ab991a10b410b0f55a9
|
4
|
+
data.tar.gz: 1e39d2dd0a44993062c3872b4580f1360b426b8a979167537fb49b674f551a23
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d43f8fb59b4004767a9d50abad95009af843ce8ca158d3e352a48ecc36498e74d1c1dcc83b25811d0cc09e7433dacf385bd36bb5bf9fd6e1de95a4cbe084bbef
|
7
|
+
data.tar.gz: c5434201664cdd7a17cc633b70249a79c8cebafe55078f992a746e6042d201a18de0ec28dbba67f0690372e0936637437f93c7feeb71f8dcad79abe52aab1383
|
data/README.md
CHANGED
@@ -39,9 +39,24 @@ Or install it yourself as:
|
|
39
39
|
|
40
40
|
## Development
|
41
41
|
|
42
|
-
After checking out the repo,
|
42
|
+
After checking out the repo, build the gem and start a bash using Docker:
|
43
43
|
|
44
|
-
|
44
|
+
```bash
|
45
|
+
docker-compose build
|
46
|
+
docker-compose run gem bash
|
47
|
+
```
|
48
|
+
|
49
|
+
For testing using the rails console, make sure you're in the `test/dummy` folder:
|
50
|
+
|
51
|
+
```bash
|
52
|
+
cd test/dummy
|
53
|
+
rails db:reset # if you haven't done this yet
|
54
|
+
rails console
|
55
|
+
```
|
56
|
+
|
57
|
+
To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
58
|
+
|
59
|
+
You can push the gem inside the container. Caveat: you will need to log in every time you push the gem since the container will discard all system files when destroyed.
|
45
60
|
|
46
61
|
## Contributing
|
47
62
|
|
@@ -5,11 +5,11 @@ module TanoshimuUtils
|
|
5
5
|
|
6
6
|
class_methods do
|
7
7
|
def has_translatable_field(name, foreign_key: :model_id)
|
8
|
-
p "USING METHOD"
|
9
8
|
set_translatable_field = :"#{name}="
|
10
9
|
get_translatable_field = :"#{name}"
|
11
10
|
record_field = :"#{name}_record"
|
12
11
|
record_class = Object.const_get(name.capitalize)
|
12
|
+
current_class_name = self
|
13
13
|
|
14
14
|
send(:define_method, get_translatable_field) do
|
15
15
|
instance_variable_get("@#{name}") ||
|
@@ -19,7 +19,7 @@ module TanoshimuUtils
|
|
19
19
|
send(:define_method, set_translatable_field) do |new_record_field|
|
20
20
|
return unless new_record_field.kind_of?(record_class)
|
21
21
|
|
22
|
-
new_record_field.used_by_model =
|
22
|
+
new_record_field.used_by_model = current_class_name.table_name
|
23
23
|
new_record_field.send(:"#{foreign_key}=", self.id)
|
24
24
|
self.send(:"#{record_field}=", new_record_field)
|
25
25
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: tanoshimu_utils
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.0.2
|
4
|
+
version: 2.0.2.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Akinyele Cafe-Febrissy
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-
|
11
|
+
date: 2020-09-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|