Combining 2 hash fields in a single database field

Hello Gurus,
I have a form which has a phone_no field. I want to provide 3 text
fields to user to split and enter the phone number in country_code,
state_code and the number which will be contacted and entered in to
the phone_no field with some delimiter (-)

The same functionality will be for address_1, and address_2 fields,
which will be merged in to a single address field.
any pointers suggestions to implement this functionality.

Thanks in advance

  • S

Sachin wrote:

Hello Gurus,
I have a form which has a phone_no field. I want to provide 3 text
fields to user to split and enter the phone number in country_code,
state_code and the number which will be contacted and entered in to
the phone_no field with some delimiter (-)

The same functionality will be for address_1, and address_2 fields,
which will be merged in to a single address field.
any pointers suggestions to implement this functionality.

Just munge the strings in the model’s before_save or constructor.

Thanks in advance

  • S

Best,

Marnen Laibow-Koser
http://www.marnen.org
[email protected]

Thanks for the pointer Marnen, i shall try it out.

  • S