bank 0.1.10 → 0.1.11
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/bank/collection.rb +5 -3
- data/lib/bank/collection_config.rb +1 -0
- data/lib/bank/model.rb +1 -1
- data/lib/bank/serialize.rb +2 -0
- 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: 18889ba4a4570b3506bd3373d0238031eba17f12
|
4
|
+
data.tar.gz: e34ffc1f90e7cbbc0eb5a8dfb572ba50fec2a192
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1d7ef7ddefd179639b2c056a588d243115f81632dfb16227159033aefcdb6df63fa3fc20272c9d3bb97f196c7fac1149a2e2c6f71f1e2304658701582a273785
|
7
|
+
data.tar.gz: e71b17e2d88ca8d6b2c6e47dd5a2f5c850bede3479d7d8f1bca13508bc271b5263d38866df507d6cb8b39e1e454e0d384abffe66a001c98368ef9fb9837978a0
|
data/lib/bank/collection.rb
CHANGED
@@ -26,6 +26,10 @@ module Bank
|
|
26
26
|
Result.new(config.db, self)
|
27
27
|
end
|
28
28
|
|
29
|
+
def scope(name, blk)
|
30
|
+
define_singleton_method(name) { |*args| instance_exec *args, &blk }
|
31
|
+
end
|
32
|
+
|
29
33
|
def find_by(key, value)
|
30
34
|
where(key => value).first
|
31
35
|
end
|
@@ -80,12 +84,10 @@ module Bank
|
|
80
84
|
end
|
81
85
|
|
82
86
|
def join_select(table, *args, &blk)
|
83
|
-
select(*config.model._fields.map { |f| :"#{table}__#{f}"}).
|
87
|
+
select(*config.model.config._fields.map { |f| :"#{table}__#{f}"}).
|
84
88
|
join(*args, &blk)
|
85
89
|
end
|
86
90
|
|
87
|
-
private
|
88
|
-
|
89
91
|
def new?(model)
|
90
92
|
model.send(config.primary_key).nil?
|
91
93
|
end
|
data/lib/bank/model.rb
CHANGED
data/lib/bank/serialize.rb
CHANGED