Commit abd9f8d52f84c2292f91ae96d7dcbf063eac6570
1 parent
08b594d9
Exists in
master
Adding city and states
Showing
1 changed file
with
13 additions
and
0 deletions
Show diff stats
lib/ext/person.rb
| @@ -6,4 +6,17 @@ class Person | @@ -6,4 +6,17 @@ class Person | ||
| 6 | 6 | ||
| 7 | attr_accessible :orientacao_sexual, :identidade_genero, :transgenero, :tipo, :etnia | 7 | attr_accessible :orientacao_sexual, :identidade_genero, :transgenero, :tipo, :etnia |
| 8 | 8 | ||
| 9 | + def city= city | ||
| 10 | + city = City.find(city) unless city.kind_of?(City) | ||
| 11 | + self.region = city | ||
| 12 | + end | ||
| 13 | + | ||
| 14 | + def city | ||
| 15 | + self.region | ||
| 16 | + end | ||
| 17 | + | ||
| 18 | + def state | ||
| 19 | + self.region.parent if self.region | ||
| 20 | + end | ||
| 21 | + | ||
| 9 | end | 22 | end |