person-name 0.2.9 → 0.2.10

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/VERSION CHANGED
@@ -1 +1 @@
1
- 0.2.9
1
+ 0.2.10
@@ -43,6 +43,7 @@ module PersonName
43
43
 
44
44
  base.before_validation :start_name_validation
45
45
  base.after_validation :stop_name_validation
46
+ base.before_save :cache_full_names
46
47
  #base.define_scopes
47
48
  end
48
49
 
@@ -175,6 +176,12 @@ module PersonName
175
176
  @name_validation = false
176
177
  end
177
178
 
179
+ def cache_full_names
180
+ self.class.name_types.map(&:to_s).each do |name_type|
181
+ write_attribute(name_type.to_sym, person_name_for(name_type).full_name)
182
+ end
183
+ end
184
+
178
185
  end
179
186
 
180
187
  end
@@ -145,7 +145,12 @@ describe "Has Person Name" do
145
145
  }
146
146
  @person.name.to_s.should == "Matthijs Jacobus Groen"
147
147
  @person.name.last_name.should == "Jacobus Groen"
148
+ @person.birth_name = "Test fill for Validation"
148
149
 
150
+ @person.save.should be_true
151
+
152
+ p = NamePerson.find_by_name "Matthijs Jacobus Groen"
153
+ p.should == @person
149
154
  end
150
155
 
151
156
  it "should use the individual fields as edit post attributes match almost" 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: 5
4
+ hash: 3
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 2
9
- - 9
10
- version: 0.2.9
9
+ - 10
10
+ version: 0.2.10
11
11
  platform: ruby
12
12
  authors:
13
13
  - Matthijs Groen
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2010-10-26 00:00:00 +02:00
18
+ date: 2010-10-28 00:00:00 +02:00
19
19
  default_executable:
20
20
  dependencies: []
21
21
 
@@ -43,6 +43,7 @@ files:
43
43
  - spec/database.yml
44
44
  - spec/database.yml.sample
45
45
  - spec/models.rb
46
+ - spec/person_name/has_person_name.sqlite3
46
47
  - spec/person_name/has_person_name_spec.rb
47
48
  - spec/schema.rb
48
49
  - spec/spec_helper.rb