nilly_vanilly 0.2.0 → 0.3.0
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.
- data/.gitignore +2 -1
- data/CHANGELOG.md +5 -0
- data/Gemfile +1 -0
- data/Gemfile.lock +3 -1
- data/lib/nilly_vanilly/nillify.rb +8 -3
- data/lib/nilly_vanilly/railtie.rb +7 -0
- data/lib/nilly_vanilly/version.rb +1 -1
- data/lib/nilly_vanilly.rb +2 -0
- metadata +23 -31
data/.gitignore
CHANGED
data/CHANGELOG.md
CHANGED
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
nilly_vanilly (0.
|
4
|
+
nilly_vanilly (0.3.0)
|
5
5
|
|
6
6
|
GEM
|
7
7
|
remote: http://rubygems.org/
|
@@ -10,6 +10,7 @@ GEM
|
|
10
10
|
activesupport (= 2.3.12)
|
11
11
|
activesupport (2.3.12)
|
12
12
|
diff-lcs (1.1.2)
|
13
|
+
rake (10.0.3)
|
13
14
|
rspec (2.6.0)
|
14
15
|
rspec-core (~> 2.6.0)
|
15
16
|
rspec-expectations (~> 2.6.0)
|
@@ -26,5 +27,6 @@ PLATFORMS
|
|
26
27
|
DEPENDENCIES
|
27
28
|
activerecord (>= 2)
|
28
29
|
nilly_vanilly!
|
30
|
+
rake
|
29
31
|
rspec
|
30
32
|
sqlite3
|
@@ -1,23 +1,28 @@
|
|
1
1
|
module NillyVanilly
|
2
|
+
# Inject the nillifcation process in ActiveRecord
|
2
3
|
module Nillify
|
3
4
|
def self.included(base)
|
4
5
|
base.extend ClassMethods
|
5
6
|
end
|
6
7
|
|
7
8
|
module ClassMethods
|
9
|
+
|
10
|
+
# Register a before_save hook to nillify attributes defined by nillify_attributes accessor
|
8
11
|
def nillify(*attributes)
|
9
12
|
class_eval do
|
10
13
|
before_save :nillification
|
11
14
|
end
|
12
|
-
|
15
|
+
|
13
16
|
cattr_accessor :nillify_attributes
|
14
|
-
self.nillify_attributes = attributes
|
17
|
+
self.nillify_attributes = attributes
|
15
18
|
|
16
19
|
include InstanceMethods
|
17
20
|
end
|
18
21
|
end
|
19
|
-
|
22
|
+
|
20
23
|
module InstanceMethods
|
24
|
+
|
25
|
+
# Nillify attribute if it is a empty string
|
21
26
|
def nillification
|
22
27
|
for attribute in self.class.nillify_attributes
|
23
28
|
self.send("#{attribute}=", nil) if self.send(attribute) == ""
|
data/lib/nilly_vanilly.rb
CHANGED
metadata
CHANGED
@@ -1,29 +1,24 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: nilly_vanilly
|
3
|
-
version: !ruby/object:Gem::Version
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.3.0
|
4
5
|
prerelease:
|
5
|
-
version: 0.2.0
|
6
6
|
platform: ruby
|
7
|
-
authors:
|
7
|
+
authors:
|
8
8
|
- Joost Baaij
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
|
13
|
-
date: 2011-08-12 00:00:00 +02:00
|
14
|
-
default_executable:
|
12
|
+
date: 2013-02-12 00:00:00.000000000 Z
|
15
13
|
dependencies: []
|
16
|
-
|
17
|
-
|
18
|
-
email:
|
14
|
+
description: This plugin stores NULL in your database when you try to store an empty
|
15
|
+
string.
|
16
|
+
email:
|
19
17
|
- joost@spacebabies.nl
|
20
18
|
executables: []
|
21
|
-
|
22
19
|
extensions: []
|
23
|
-
|
24
20
|
extra_rdoc_files: []
|
25
|
-
|
26
|
-
files:
|
21
|
+
files:
|
27
22
|
- .gitignore
|
28
23
|
- .rspec
|
29
24
|
- CHANGELOG.md
|
@@ -34,6 +29,7 @@ files:
|
|
34
29
|
- lib/nilly_vanilly.rb
|
35
30
|
- lib/nilly_vanilly/inspect.rb
|
36
31
|
- lib/nilly_vanilly/nillify.rb
|
32
|
+
- lib/nilly_vanilly/railtie.rb
|
37
33
|
- lib/nilly_vanilly/version.rb
|
38
34
|
- lib/tasks/nilly_vanilly.rake
|
39
35
|
- nilly_vanilly.gemspec
|
@@ -44,35 +40,31 @@ files:
|
|
44
40
|
- spec/nilly_vanilly_spec.rb
|
45
41
|
- spec/spec_helper.rb
|
46
42
|
- spec/support/database.rb
|
47
|
-
has_rdoc: true
|
48
43
|
homepage: https://github.com/tilsammans/nilly_vanilly
|
49
44
|
licenses: []
|
50
|
-
|
51
45
|
post_install_message:
|
52
46
|
rdoc_options: []
|
53
|
-
|
54
|
-
require_paths:
|
47
|
+
require_paths:
|
55
48
|
- lib
|
56
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
49
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
57
50
|
none: false
|
58
|
-
requirements:
|
59
|
-
- -
|
60
|
-
- !ruby/object:Gem::Version
|
61
|
-
version:
|
62
|
-
required_rubygems_version: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ! '>='
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
55
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
63
56
|
none: false
|
64
|
-
requirements:
|
65
|
-
- -
|
66
|
-
- !ruby/object:Gem::Version
|
67
|
-
version:
|
57
|
+
requirements:
|
58
|
+
- - ! '>='
|
59
|
+
- !ruby/object:Gem::Version
|
60
|
+
version: '0'
|
68
61
|
requirements: []
|
69
|
-
|
70
62
|
rubyforge_project:
|
71
|
-
rubygems_version: 1.
|
63
|
+
rubygems_version: 1.8.23
|
72
64
|
signing_key:
|
73
65
|
specification_version: 3
|
74
66
|
summary: This plugin stores NULL in your database when you try to store an empty string.
|
75
|
-
test_files:
|
67
|
+
test_files:
|
76
68
|
- spec/db/database.yml.example
|
77
69
|
- spec/db/models.rb
|
78
70
|
- spec/db/schema.rb
|