repositor 0.6.0 → 0.7.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/repositor.rb +1 -0
- data/lib/repositor/active_record.rb +5 -16
- metadata +9 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a835c07a8cc827540622af5ae3b509078e410dc7
|
4
|
+
data.tar.gz: 5f727e08def247a8fbce3741ed160def88b94631
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 709cdc84bbf37a0b5c9da5e4aad0b073560a6c330991ecafd2576d8cb4cb87e139a450fb01ab9eb9f6d7033d9bdf1ac869010a455dc49d12dae58c90d43a450a
|
7
|
+
data.tar.gz: 1b5ca23b4479bfcb8864609a7f5e2f6d18ccf0b7efa61a2b41f57ea4471326aa3c2f2e9073867b745280813f7d852256ee82f5b3ecc47223f09547f304fe32c9
|
data/lib/repositor.rb
CHANGED
@@ -2,29 +2,18 @@ module Repositor
|
|
2
2
|
module ActiveRecord
|
3
3
|
attr_reader :model
|
4
4
|
|
5
|
-
|
6
|
-
@model = model || self.class.to_s.chomp("Repo").singularize.constantize
|
7
|
-
end
|
8
|
-
|
9
|
-
def find(record_id)
|
10
|
-
model.send :find, record_id
|
11
|
-
end
|
5
|
+
delegate :find, :all, :new, :create, to: :model
|
12
6
|
|
13
|
-
def
|
14
|
-
model.
|
15
|
-
end
|
16
|
-
|
17
|
-
def new
|
18
|
-
model.send :new
|
7
|
+
def initialize(model: nil)
|
8
|
+
@model = model || self.class.to_s.chomp("Repo").singularize.constantize
|
19
9
|
end
|
20
10
|
|
21
|
-
def
|
22
|
-
model.
|
11
|
+
def friendly_find(id)
|
12
|
+
model.friendly.find(id)
|
23
13
|
end
|
24
14
|
|
25
15
|
def update(record, record_params)
|
26
16
|
record.update(record_params)
|
27
|
-
record
|
28
17
|
end
|
29
18
|
|
30
19
|
def destroy(record)
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: repositor
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.7.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Volodya Sveredyuk
|
@@ -48,16 +48,22 @@ dependencies:
|
|
48
48
|
name: activesupport
|
49
49
|
requirement: !ruby/object:Gem::Requirement
|
50
50
|
requirements:
|
51
|
+
- - "~>"
|
52
|
+
- !ruby/object:Gem::Version
|
53
|
+
version: '4.0'
|
51
54
|
- - ">="
|
52
55
|
- !ruby/object:Gem::Version
|
53
|
-
version:
|
56
|
+
version: 4.0.0
|
54
57
|
type: :runtime
|
55
58
|
prerelease: false
|
56
59
|
version_requirements: !ruby/object:Gem::Requirement
|
57
60
|
requirements:
|
61
|
+
- - "~>"
|
62
|
+
- !ruby/object:Gem::Version
|
63
|
+
version: '4.0'
|
58
64
|
- - ">="
|
59
65
|
- !ruby/object:Gem::Version
|
60
|
-
version:
|
66
|
+
version: 4.0.0
|
61
67
|
description: Create simple Repos for Rails Controllers
|
62
68
|
email: sveredyuk@gmail.com
|
63
69
|
executables: []
|