person-name 0.2.5 → 0.2.6

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.2.5
1
+ 0.2.6
@@ -6,11 +6,11 @@ module ActiveRecord
6
6
 
7
7
  def person_name(name, *args)
8
8
  options = args.extract_options!
9
+ column("#{name}".to_sym, :string, :null => true)
9
10
  name_parts = PersonName::NameSplitter::NAME_PARTS
10
11
  name_parts.each do |part|
11
12
  column("#{name}_#{part}".to_sym, :string, :null => true)
12
13
  end
13
- column("#{name}".to_sym, :string, :null => true)
14
14
  end
15
15
 
16
16
  end
@@ -9,6 +9,7 @@ module PersonName
9
9
  # Splits the given name in individual name parts in form of a hash.
10
10
  # You can supply a hash with existing values for editing purposes.
11
11
  def self.split(new_name_str, existing_values = {})
12
+ return {} if new_name_str.nil?
12
13
  parts = new_name_str.split " "
13
14
  names = []
14
15
  stage = :prefix
@@ -98,6 +98,13 @@ describe "Has Person Name" do
98
98
  @person.name.last_name.should == "Cabau van Kasbergen"
99
99
  end
100
100
 
101
+ it "should accept a nil value" do
102
+ @person.name = nil
103
+ @person.save
104
+
105
+ @person.name.to_s.should == ""
106
+ end
107
+
101
108
  end
102
109
 
103
110
  describe "dynamic scopes" do
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: person-name
3
3
  version: !ruby/object:Gem::Version
4
- hash: 29
4
+ hash: 27
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 2
9
- - 5
10
- version: 0.2.5
9
+ - 6
10
+ version: 0.2.6
11
11
  platform: ruby
12
12
  authors:
13
13
  - Matthijs Groen