smart_collection 0.1 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/smart_collection/mixin.rb +2 -0
- data/lib/smart_collection/validator.rb +10 -0
- data/lib/smart_collection/version.rb +1 -1
- metadata +4 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 187bb48a7b917cc0b0f8e068fb48f32a559d9ffb
|
4
|
+
data.tar.gz: fb246fd8dd0ca7c3cd1a8ed01d57a699dfa9433b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: de0fdf1c0a01d34314a4e6d6665ef945dbb195ef728519ef8a874f7b4961c9c4547679245ce7eae2b0ca999bccf939ee715404c9c05a8b385ec9b74944a4b3f7
|
7
|
+
data.tar.gz: 85aa4af37c448c96684b30a9764b677fd62f9de0de6d152cc81501ce40cf2aa7920695e7e29e5407236e2a5e87ad72ff5e02c88293c649b506293124433e07d1
|
@@ -0,0 +1,10 @@
|
|
1
|
+
module SmartCollection
|
2
|
+
class Validator < ActiveModel::Validator
|
3
|
+
def validate record
|
4
|
+
# try to build scope
|
5
|
+
record.association(record.smart_collection_mixin.config.items_name).scope
|
6
|
+
rescue Exception => e
|
7
|
+
record.errors.add(:failed_to_build_scope, e)
|
8
|
+
end
|
9
|
+
end
|
10
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: smart_collection
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- CicholGricenchos
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2019-05-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activerecord
|
@@ -103,6 +103,7 @@ files:
|
|
103
103
|
- lib/smart_collection/config.rb
|
104
104
|
- lib/smart_collection/mixin.rb
|
105
105
|
- lib/smart_collection/reflection/smart_collection_reflection.rb
|
106
|
+
- lib/smart_collection/validator.rb
|
106
107
|
- lib/smart_collection/version.rb
|
107
108
|
homepage: https://github.com/CicholGricenchos/smart_collection
|
108
109
|
licenses:
|
@@ -124,7 +125,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
124
125
|
version: '0'
|
125
126
|
requirements: []
|
126
127
|
rubyforge_project:
|
127
|
-
rubygems_version: 2.5.2.
|
128
|
+
rubygems_version: 2.5.2.3
|
128
129
|
signing_key:
|
129
130
|
specification_version: 4
|
130
131
|
summary: collections by rules
|