This is very similar to the problem of partially updating Rails with hashes , but IMHO did not actually answer this question.
The problem is this: I have a model with a serialized column:
class Import < AR::Base serialize :data
In my case, this data will and should not change after the first save / create model. So I want to disable the AR function, which always saves serialized columns (which is usually a good idea since it cannot detect these changes). I want to disable saving because the data can be quite large and the model will be updated frequently.
I already tried monkeypatching in ActiceRecord :: AttributeMethods :: Dirty like this:
class Import def update(*) if partial_updates? super(changed | (attributes.keys & (self.class.serialized_attributes.keys - ["data"]))) else super end end
but this does not seem to have any effect. Has anyone got a better idea?
This is under Rails 3.0.12
source share