backframe 0.0.11 → 0.0.13
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/backframe/activerecord/acts_as_enum.rb +9 -3
- data/lib/backframe/version.rb +1 -1
- 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: 41c865ad3f5adda1a6d1799258e50b796f6639f8
|
4
|
+
data.tar.gz: 957fa7a9d3177940999662ef37925cc8a310605a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1ffb061c4285eba6192b2a6fd163700515a9b072e223c9922f09b59d9c9186a6790ebdcecaf41dd5317862a500b6482bc6558fe7ca0e66c04c1249f75877ce42
|
7
|
+
data.tar.gz: 1975fecd01a6503f2d9745e96a35bc120eb5299ab95daf068ab791e1f3aa4cb2ad0d873dde40ca48ed55146271c426d0c554543bfed07765e0b0531421b770fa
|
@@ -15,7 +15,6 @@ module Backframe
|
|
15
15
|
field = args[0]
|
16
16
|
arguments = args[1]
|
17
17
|
|
18
|
-
|
19
18
|
if arguments.key?(:required)
|
20
19
|
|
21
20
|
validates_presence_of field
|
@@ -38,14 +37,21 @@ module Backframe
|
|
38
37
|
|
39
38
|
validates_inclusion_of field, :in => arguments[:in]
|
40
39
|
|
40
|
+
class_eval <<-EOV
|
41
|
+
scope :#{field}_is, -> (*options) { where('#{field} IN (?)', (options.is_a?(Array) ? options : [options])) }
|
42
|
+
EOV
|
43
|
+
|
44
|
+
class_eval <<-EOV
|
45
|
+
scope :#{field}_not, -> (*options) { where('#{field} NOT IN (?)', (options.is_a?(Array) ? options : [options])) }
|
46
|
+
EOV
|
47
|
+
|
41
48
|
arguments[:in].each do |option|
|
42
49
|
class_eval <<-EOV
|
43
|
-
scope :#{field}_#{option}, -> {
|
50
|
+
scope :#{field}_#{option}, -> { #{field}_is(option) }
|
44
51
|
|
45
52
|
def #{field}_#{option}?
|
46
53
|
self.#{field} == '#{option}'
|
47
54
|
end
|
48
|
-
|
49
55
|
EOV
|
50
56
|
end
|
51
57
|
|
data/lib/backframe/version.rb
CHANGED