This project is archived and is in readonly mode.
ActiveRecord::Base.execute_callstack_for_multiparameter_attributes doesn't appear to handle serialized columns
-
Mike Summers
- No changes were found…
-
Prem Sichanugrist (sikachu)
- Importance changed from to Low
Hi,
Do you still see this bug on current 3.0.1? Could you provide a failing test case?
Thanks
-
Aditya Sanghi
Hi Mike,
We're currently discussing refactoring of the multiparameter assignment in ticket 4346. You may want to have a look at that thread too but although that issue is related to multiparameter and time class, it is not dealing specifically with serialized attributes.
Additionally, i think the solution you are suggesting is only for serialized attributes which although an edge use case, it not the usual way to do things.
Currently the klass of the attribute is determined by reflection over an association OR by column_for_attribute(name_of_column). The class is finally determined by sending the method "klass" on the returned object. You need to update your model, to ensure that column_for_attribute(your_serialized_column) returns a Time Column object, so that running "klass" on it returns "Time", then you're set to go.
The code below should get you started.
class YourModel < ActiveRecord::Base columns_hash["your_serialized_time_column"] = ActiveRecord::ConnectionAdapters::Column.new("your_serialized_time_column", nil, "time") endDo let us know if this helps you.
-
Aditya Sanghi
- State changed from new to wontfix
Not sure if there is any clean way to determine the class of the serialized attribute. Closing this ticket as wontfix given that the above solution should work. Can re-open if the solution above doesnt work.