File tree Expand file tree Collapse file tree 1 file changed +11
-1
lines changed Expand file tree Collapse file tree 1 file changed +11
-1
lines changed Original file line number Diff line number Diff line change @@ -9,14 +9,24 @@ def stage_changes(attributes)
9
9
new_pending_changes =
10
10
attributes . each_with_object ( { } ) do |( attr , new_value ) , staged_changes |
11
11
current_value = public_send ( attr )
12
- staged_changes [ attr . to_s ] = new_value if new_value != current_value
12
+
13
+ if normalise_for_comparison ( new_value ) ==
14
+ normalise_for_comparison ( current_value )
15
+ public_send ( "#{ attr } =" , new_value ) if new_value != current_value
16
+ else
17
+ staged_changes [ attr . to_s ] = new_value
18
+ end
13
19
end
14
20
15
21
if new_pending_changes . any?
16
22
update! ( pending_changes : pending_changes . merge ( new_pending_changes ) )
17
23
end
18
24
end
19
25
26
+ def normalise_for_comparison ( value )
27
+ value . respond_to? ( :downcase ) ? value . downcase : value
28
+ end
29
+
20
30
def with_pending_changes
21
31
return self if pending_changes . blank?
22
32
You can’t perform that action at this time.
0 commit comments