Commit 991af12920ab4703edc4fb1662acde3c2dde25cf
Committed by
Rafael Martins
1 parent
152c4ed6
Exists in
master
and in
22 other branches
Fix module methods' overwriting
Showing
1 changed file
with
6 additions
and
4 deletions
Show diff stats
lib/set_profile_region_from_city_state.rb
| @@ -5,18 +5,20 @@ module SetProfileRegionFromCityState | @@ -5,18 +5,20 @@ module SetProfileRegionFromCityState | ||
| 5 | before_save :region_from_city_and_state | 5 | before_save :region_from_city_and_state |
| 6 | 6 | ||
| 7 | include InstanceMethods | 7 | include InstanceMethods |
| 8 | + alias_method_chain :city=, :region | ||
| 9 | + alias_method_chain :state=, :region | ||
| 8 | end | 10 | end |
| 9 | end | 11 | end |
| 10 | 12 | ||
| 11 | module InstanceMethods | 13 | module InstanceMethods |
| 12 | 14 | ||
| 13 | - def city=(value) | ||
| 14 | - self.data[:city] = value | 15 | + def city_with_region=(value) |
| 16 | + self.city_without_region = value | ||
| 15 | @change_region = true | 17 | @change_region = true |
| 16 | end | 18 | end |
| 17 | 19 | ||
| 18 | - def state=(value) | ||
| 19 | - self.data[:state] = value | 20 | + def state_with_region=(value) |
| 21 | + self.state_without_region = value | ||
| 20 | @change_region = true | 22 | @change_region = true |
| 21 | end | 23 | end |
| 22 | 24 |