repositor 0.3.1 → 0.3.2
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 +3 -1
- data/lib/repositor/active_record.rb +4 -3
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: b791fa82cca7c661465fa33f28d853cd66b38b43
|
|
4
|
+
data.tar.gz: 2f287c896d0c1d6dc293bda6fe84972ae9dbdc4d
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: c3d1f29f026746bcae34f635c6fc8ff7c809f820f729ac74b04b79d8afccee81e2d80961a0a590649a925e374d75c2622ee58a5191590ddc47c4e580b8a29a75
|
|
7
|
+
data.tar.gz: e6be6fbbd5d5a28dca4c6bc2eb185010ce5649e6f0c6bbc570943779ef1063982f735fea42707c5dcdc59d7e79b13f20cd5bd06e4e276ce826933eaa43631c3d
|
data/README.md
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
# Repositor
|
|
2
2
|
|
|
3
|
+
[gem]: https://rubygems.org/gems/repositor
|
|
4
|
+
|
|
3
5
|
## Installation & Setup
|
|
4
6
|
|
|
5
7
|
In gemfile:
|
|
@@ -106,7 +108,7 @@ end
|
|
|
106
108
|
|
|
107
109
|
Than you need to create `products_repo.rb`:
|
|
108
110
|
```ruby
|
|
109
|
-
class ProductsRepo < ApplicationRepo
|
|
111
|
+
class ProductsRepo < ApplicationRepo
|
|
110
112
|
# here you will have default methods for repo actions
|
|
111
113
|
end
|
|
112
114
|
```
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
module Repositor
|
|
2
2
|
module ActiveRecord
|
|
3
|
-
attr_reader :model
|
|
3
|
+
attr_reader :model, :options
|
|
4
4
|
|
|
5
|
-
def initialize(model: nil)
|
|
6
|
-
@model
|
|
5
|
+
def initialize(model: nil, options = {})
|
|
6
|
+
@model = model || self.class.to_s.chomp("Repo").singularize.constantize
|
|
7
|
+
@options = options
|
|
7
8
|
end
|
|
8
9
|
|
|
9
10
|
def find(record_id)
|