This project is archived and is in readonly mode.

#3791 ✓wontfix
Mike Summers

ActiveRecord::Base.execute_callstack_for_multiparameter_attributes doesn't appear to handle serialized columns

Reported by Mike Summers | January 26th, 2010 @ 09:57 PM

I'm getting "... error(s) on assignment of multiparameter attributes" out of execute_callstack_for_multiparameter_attribute on a serialized column that is a Time because column_for_attributes returns String.

This line inserted after the call to column_for_attributes (line #3055 in base.rb for 2.3.5) is my take at fixing things up:

klass = (Time.is_a?(self.class.serialized_attributes[name]) ? Time :

    (Date.is_a?(self.class.serialized_attributes[name]) ? Date : self.class.serialized_attributes[name])) if self.class.serialized_attributes.key?(name)

My column is serialized generically as an Object which leads to the is_a? 's

Comments and changes to this ticket

  • Mike Summers

    Mike Summers January 26th, 2010 @ 09:58 PM

    • no changes were found...
  • Prem Sichanugrist (sikachu)

    Prem Sichanugrist (sikachu) October 17th, 2010 @ 05:36 PM

    • Importance changed from “” to “Low”


    Do you still see this bug on current 3.0.1? Could you provide a failing test case?


  • Aditya Sanghi

    Aditya Sanghi October 17th, 2010 @ 06:54 PM

    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"] ="your_serialized_time_column", nil, "time")

    Do let us know if this helps you.

  • Aditya Sanghi

    Aditya Sanghi October 21st, 2010 @ 11:32 AM

    • 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.

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile »

<h2 style="font-size: 14px">Tickets have moved to Github</h2>

The new ticket tracker is available at <a href=""></a>