I have a model which I would like to have a ‘virtual’ date column.
This column wouldn’t exist in the database, but would exist for
validation, etc. The data would be provided in the form of a
date_select in the view. This produces a multiparameter attribute. My
problem is that the ‘execute_callstack_for_multiparameter_attributes’
method in base.rb of ActiveRecord looks at the columns array to
determine the ‘class’ (klass) to use when doing the multiparameter
conversion. Since this column doesn’t really exist nothing is found
and an exception is thrown when trying to evaluate nil.klass.
I’m willing to provide a patch, but I am not what would be the best
way to provide the type information. Any suggestions?
Hi, I have this same issue, it looks like the
execute_callstack_for_multiparameter_attributes assumes that all
muti-parameter attributes are persistent.
the code in there is way over my head also, does anyone have suggestions
of how to get this to work? or an elegant work around? (for now im going
to roll my own time_select helper I guess)
To reproduce this issue, add attr_accessor :foo to any active record and
then try to use a helper that is multi parameter (time,date etc) like
time_select on it. On submit you will get:
NoMethodError (You have a nil object when you didn’t expect it!
The error occurred while evaluating nil.klass):