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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 9f479b5262f4acf4557bce9c9afaefdd07c4c204
4
- data.tar.gz: a1c9524cfad044566fae79aa21a6bb2286c581bf
3
+ metadata.gz: 187bb48a7b917cc0b0f8e068fb48f32a559d9ffb
4
+ data.tar.gz: fb246fd8dd0ca7c3cd1a8ed01d57a699dfa9433b
5
5
  SHA512:
6
- metadata.gz: 21811df6d87e734e1565ea5f29c665e1057ca8f7206e1f53b71582d74c35ed821637eff906d5bb5d430d52c366024377c7829ecf48de3a86bf5f631a3e9a67d0
7
- data.tar.gz: b92c5993149a07987a08bfa22826334611fd5cdc9fd7970daa5a3f321d340a6bbe9f62cd8a316a2eeafb3daad818cd99bc6a2fe00a7df9cd64ce6cd9bba8c1ff
6
+ metadata.gz: de0fdf1c0a01d34314a4e6d6665ef945dbb195ef728519ef8a874f7b4961c9c4547679245ce7eae2b0ca999bccf939ee715404c9c05a8b385ec9b74944a4b3f7
7
+ data.tar.gz: 85aa4af37c448c96684b30a9764b677fd62f9de0de6d152cc81501ce40cf2aa7920695e7e29e5407236e2a5e87ad72ff5e02c88293c649b506293124433e07d1
@@ -50,6 +50,8 @@ module SmartCollection
50
50
  config.cache_manager = cache_class.new(model: base, config: config)
51
51
  end
52
52
 
53
+ base.validates_with SmartCollection::Validator
54
+
53
55
  end
54
56
  end
55
57
  end
@@ -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
@@ -1,3 +1,3 @@
1
1
  module SmartCollection
2
- VERSION = '0.1'
2
+ VERSION = '0.1.1'
3
3
  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: '0.1'
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: 2018-01-09 00:00:00.000000000 Z
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.1
128
+ rubygems_version: 2.5.2.3
128
129
  signing_key:
129
130
  specification_version: 4
130
131
  summary: collections by rules