Commit 991af12920ab4703edc4fb1662acde3c2dde25cf
Committed by
Rafael Martins
1 parent
152c4ed6
Exists in
master
and in
28 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 | 5 | before_save :region_from_city_and_state |
6 | 6 | |
7 | 7 | include InstanceMethods |
8 | + alias_method_chain :city=, :region | |
9 | + alias_method_chain :state=, :region | |
8 | 10 | end |
9 | 11 | end |
10 | 12 | |
11 | 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 | 17 | @change_region = true |
16 | 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 | 22 | @change_region = true |
21 | 23 | end |
22 | 24 | ... | ... |