checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
---
2
2
SHA256:
3
- metadata.gz: f11f9efd6d4be576684b4cf4fd295782b5ab7879b99d4ebf61a1ade990ddc7f1
4
- data.tar.gz: e735560c43ca6e0e8dbf3c5064708a14b9a5c4a9ce2dd9ee54e977d9eaef70d6
3
+ metadata.gz: 2737c3dd29e321d958b4f5e07280b56f811559f039d638089dad14df0eab8188
4
+ data.tar.gz: b8fcbb969bfa0aed76999286cf6a5e536806a19e0b982ee4a9660f3e50bdd5a0
5
5
SHA512:
6
- metadata.gz: 123b9e32ecce2fa3cff2d223b3e5af0eea58bacd6f5a3beb927e9dc222694547d6c8d2674271dff188b89368dc84a93b9081f750b710cb8964f249cc9ea8c287
7
- data.tar.gz: 88424ae71b9ba6b5d7b54bbac8192e842b49bee937190addfd28c1dc103f16c105314d0ad6940e89d094d89d18605373ba95a2aececf58dd029e6991096ebc0d
6
+ metadata.gz: b3aad8f7f25a062e47f7b7cc039ffe5f2236de2b7200c874a3adc118495dc27d516b0029155e420c06e18f44861522f782ff92b2c32f0828c34e834fe0c745f1
7
+ data.tar.gz: 1c3f26c3865dc0dd55a0c85622e708ecae71e1b5bd29fb8943978ff5e152e982dc3cf2b26b188be050abe449b237c5a3d84dff09ca8b6ae07b43eacee4c525e0
data/README.md CHANGED
@@ -1,2 +1,46 @@
1
1
# ar_memoization
2
2
ArMemoization is a library for memoize ActiveRecord objects and search there.
3
+
4
+ This library has two modules.
5
+
6
+ * ArMemoization::PrimaryMethods
7
+ * ArMemoization::ForeignMethods
8
+
9
+ ```PrimaryMethods``` module contains methods to memoize Model instances.
10
+ This module is used for the Model of a table that hardly changes data.
11
+
12
+ ```ForeignMethods``` module contains methods that handle the memoized data of the Model using ```PrimaryMethods```.
13
+ This module is used in the Model that belongs_to the Model that uses ```PrimaryMethods```.
14
+
15
+ ## example
16
+
17
+ migration
18
+ ```ruby
19
+ class CreateAllTables < ActiveRecord::Migration[5.0]
20
+ def self.up
21
+ create_table(:countries) do |t|
22
+ t.string :name
23
+ end
24
+
25
+ create_table(:shops) do |t|
26
+ t.belongs_to :country
27
+ t.string :name
28
+ end
29
+ end
30
+ end
31
+ ```
32
+
33
+ app/models/country.rg
34
+ ```ruby
35
+ class Country < ActiveRecord::Base
36
+ extend ArMemoization::PrimaryMethods
37
+ end
38
+ ```
39
+
40
+ app/models/shop.rb
41
+ ```ruby
42
+ class Shop < ActiveRecord::Base
43
+ extend ArMemoization::ForeignMethods
44
+ belongs_to_memoized :country
45
+ end
46
+ ```
data/ar_memoization.gemspec CHANGED
@@ -22,7 +22,9 @@ Gem::Specification.new do |spec|
22
22
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
23
23
spec.require_paths = ["lib"]
24
24
25
- spec.add_dependency "activerecord", "~> 5.0"
25
+ spec.required_ruby_version = ">= 1.9.2"
26
+
27
+ spec.add_dependency "activerecord", ">= 5.0"
26
28
27
29
spec.add_development_dependency "bundler", "~> 1.17"
28
30
spec.add_development_dependency "rake"
data/lib/ar_memoization/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
module ArMemoization
2
- VERSION = "0.1.0"
2
+ VERSION = "0.1.1"
3
3
end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
--- !ruby/object:Gem::Specification
2
2
name: ar_memoization
3
3
version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
platform: ruby
6
6
authors:
7
7
- Yoshihiro SATO
@@ -14,14 +14,14 @@ dependencies:
14
14
name: activerecord
15
15
requirement: !ruby/object:Gem::Requirement
16
16
requirements:
17
- - - "~>"
17
+ - - ">="
18
18
- !ruby/object:Gem::Version
19
19
version: '5.0'
20
20
type: :runtime
21
21
prerelease: false
22
22
version_requirements: !ruby/object:Gem::Requirement
23
23
requirements:
24
- - - "~>"
24
+ - - ">="
25
25
- !ruby/object:Gem::Version
26
26
version: '5.0'
27
27
- !ruby/object:Gem::Dependency
@@ -114,7 +114,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
114
114
requirements:
115
115
- - ">="
116
116
- !ruby/object:Gem::Version
117
- version: '0'
117
+ version: 1.9.2
118
118
required_rubygems_version: !ruby/object:Gem::Requirement
119
119
requirements:
120
120
- - ">="