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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: ceb19bd51af668df54c36d3a3816736fa30429d0ef102a2a2988e2fb69f683b5
4
- data.tar.gz: bd6076c5b8bd97f004ff970f2943cb3160a7ad7f2687554f5b01f05ac209838f
3
+ metadata.gz: c8d9925646696c1003bfd1550226d5f6b73b75dc66a18ab991a10b410b0f55a9
4
+ data.tar.gz: 1e39d2dd0a44993062c3872b4580f1360b426b8a979167537fb49b674f551a23
5
5
  SHA512:
6
- metadata.gz: 610bf66297ca0e5e916d1257e8c28b9ab9b4fa8969e23c0f641ac43bbd0ca7eda0c9a62edc9253b99656c1c656b3c85c6d7ab0f30fb6eb74bb3789765cc31c74
7
- data.tar.gz: 899a1446770351dfa4a53ba89e18c0b315f8672efb497072ee866e02d056efd394f3ae42122063ccb7f609f462ef7245bf1ddd8362123aee5df6b88e29ccc6f6
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, run `bin/setup` to install dependencies. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
42
+ After checking out the repo, build the gem and start a bash using Docker:
43
43
 
44
- To install this gem onto your local machine, run `bundle exec rake install`. 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).
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 = record_class.table_name
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
@@ -1,3 +1,3 @@
1
1
  module TanoshimuUtils
2
- VERSION = '2.0.2'
2
+ VERSION = '2.0.2.1'
3
3
  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-08-14 00:00:00.000000000 Z
11
+ date: 2020-09-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails