rails-has-valid 0.0.1 → 0.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 51174080f502c1b331bd1fa015d5be0f85aca650
4
- data.tar.gz: f092b32e5571d2c47dbf5fa3fcbdd2a56f22d2b7
3
+ metadata.gz: 9f1dcbe09ad9471711f4b90a0a59866df610e8fb
4
+ data.tar.gz: b1122cbf732725849079a12f6c945078e8bf6244
5
5
  SHA512:
6
- metadata.gz: b8255609de6d0893c48134ee10d06984aef7b69ec6b6e6c2fc6ea628d3dc20700bf1ab3e0012939c375bfe078c6b4309a15f38b5ec1c67296563831aaa67727f
7
- data.tar.gz: 9f6b07e749e2eb64a2155d6b41aba601903f513b2d1366e998b0115b17d1508b372b61f9c2a3ebd5276d685b296e097b8c42eaeb7bb42643caec5b136cfeae6b
6
+ metadata.gz: 61d5e93f25ecf12c6e8ca67e64f7eba9559fa3ee01e956f8408b788350a6394765a87bef60fa9400371f6ba9e7f4eebb66d13c7c7442233ecdabd7212588a4d6
7
+ data.tar.gz: 65ec9003b533d1a46f9f31430aa28e98a2b613f127283d938e5949ceafc959ead3ed9bdba50da744b333ff939d4af6cc77c711cd10a63a41f2dffb0ef5095fbb
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.0.1
1
+ 0.0.2
@@ -17,22 +17,21 @@ if defined?(ActiveRecord)
17
17
  attribute.to_sym
18
18
  end
19
19
 
20
- #
21
- # Duplicate object and run ActiveRecord validations
22
- #
23
- object = self.dup
24
- object.valid?
25
-
26
20
  #
27
21
  # Clear previous validation errors
28
22
  #
29
- errors.clear
23
+ self.errors.clear
24
+
25
+ #
26
+ # Run validations
27
+ #
28
+ self.valid?
30
29
 
31
30
  #
32
- # Add validation errors for validated_attributes
31
+ # Remove validation errors for attributes we don't want to validate
33
32
  #
34
- object.errors.to_h.each do |key, value|
35
- errors.add(key, value) if validated_attributes.include?(key)
33
+ (self.errors.messages.keys - validated_attributes).each do |key|
34
+ self.errors.delete(key)
36
35
  end
37
36
 
38
37
  errors.none?
@@ -2,16 +2,16 @@
2
2
  # DO NOT EDIT THIS FILE DIRECTLY
3
3
  # Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
4
4
  # -*- encoding: utf-8 -*-
5
- # stub: rails-has-valid 0.0.1 ruby lib
5
+ # stub: rails-has-valid 0.0.2 ruby lib
6
6
 
7
7
  Gem::Specification.new do |s|
8
8
  s.name = "rails-has-valid"
9
- s.version = "0.0.1"
9
+ s.version = "0.0.2"
10
10
 
11
11
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
12
12
  s.require_paths = ["lib"]
13
13
  s.authors = ["Juraj Masar"]
14
- s.date = "2014-05-12"
14
+ s.date = "2014-05-14"
15
15
  s.description = ""
16
16
  s.email = "mail@jurajmasar.com"
17
17
  s.extra_rdoc_files = [
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rails-has-valid
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Juraj Masar
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-05-12 00:00:00.000000000 Z
11
+ date: 2014-05-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: shoulda