- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
# We have strange bug: when company's fresher salary is updated, CompanyAnnouncement.track_update
# method is called.
# This method helps to see, was object changed or not.
# This is workaround. We should get rid of this method in future.
def self.object_changed?(obj)
# Warning: We can't have "return true if obj.changed?" here, because sometimes changed? method
# returns true when object was not really changed.
return false if !obj.changed?
obj.changes.each do |k, v|
if v[0] != v[1] && k != 'updated_at'
return true
end
end
false
end
Открываю индусский проект, который надо спасать. app/controllers - 60 контроллеров, ок. User.rb - 650 строк кода, ок. А вот и самый сок!
zvse 02.11.2015 19:15 # 0