Camping sessions not working lately? Well, it’s a problem with Rails 2.1, to be more precise: ActiveRecord 2.1.0.
This took me at least 5 hours, but I finally got it: the latest version of AR does Dirty tracking and partial SQL updates. This means it only saves a new value when it thinks the attribute has changed. Nice, but it bugs Camping. So, here’s the patch:
class Session < Base serialize :ivars def =(k, v) # :nodoc: self.ivars_will_change! # ActiveRecord 2.1 needs this! self.ivars[k] = v end
With this fix, blokk’s login is also working again. It’s built into
0.992 0.993, so you don’t need to
sudo vim your Camping gem:
# with fix for ActiveRecord 2.1 include Camping::Session class Camping::Models::Session def =(k, v) ivars_will_change! ivars[k] = v end end
UPDATE: Sorry, it seems my brain is on holiday or something. The first fix didn’t fix anything, I just forgot to test it properly. This one should work.
:note => self: Think before using