Adding multiple phones on a telephone_field in rails

0

I'm doing a customer registration here for the store and it turns out that some customers have more than 2 phone numbers the system already works with two fixed and one mobile phone fields:

<%= f.label :telcelular , "Tel. Celular" %>
<%= f.telephone_field :telcelular %>

<%= f.label :telfixo , "Tel. Fixo" %>
<%= f.telephone_field :telfixo %>

There is no way for me to create a field for each phone, since I do not know how many phone numbers each customer has, is there any possibility of saving all the phones in a field?

    
asked by anonymous 03.09.2014 / 17:25

1 answer

0

One suggestion that would not greatly affect what already exists would be to serialize these fields. Postgres for example allows you to store an array in it, and Rails has functions to serialize that array.

The only problem I believe would be to serialize objects that are already in the database. No more so you could have as many phones as you want in one field. It would just make changes to the template, driver and Javascript to print more fields in the view ...

    
06.03.2015 / 01:37