Multi parameter attributes?

Does anyone know where to find information about making use of
multi-paramter attributes (like dates) to make your own helpers?

On Saturday 07 October 2006 22:49, Bryan D. wrote:

Does anyone know where to find information about making use of
multi-paramter attributes (like dates) to make your own helpers?

Have a look at the source code of
ActiveRecord::Base#assign_multiparameter_attributes and following.

Basically, if you have a class-typed attribute (i.e
not :string, :integer and so on) where the constructor of the class
takes multiple arguments, you can indicate position and type of these
arguments in parentheses. In this way something(1i), something(2s),
something(3f) are mapped to

Something.new(
<fixnum-value-of-param-something(1i)>,
<string-value-of-param-something(2s)>,
<float-value-of-param-something(3f)>)

So, if you want to use this in a helper method, you just have to make
sure that it generates suitably named form elements

HTH,
Michael


Michael S.
mailto:[email protected]
http://www.schuerig.de/michael/

Have a look at the source code of
ActiveRecord::Base#assign_multiparameter_attributes and following.

Wow, that was an awesomely-detailed description. Thanks.