0
I need that when a new product is created it generates a number ex: 0001/2015 numero/ano_in effect and when it changes year back to zero.
I made a helper just to format the number in the views, but it does not solve the problem of automatic generation and renewal next year.
def format_product_number(product_code)
format_product = product_code[0..4]
format_product << "/#{Time.now.year}"
format_product
end
I have a form with a field:
@product
<%= f.label :product_number %>
<%= f.number_field :product_number %>
Someone knows a way to do it?
Generate automatico and add in table?
– Jefferson Alison
The bank you will use is the same sqlite?
– Alex Takitani
@Alextakitani For now yes, I am new not yet the advantages and disadvantages of other banks.
– Henrique Max
@Jeffersonalison Auto generate, type as the ID itself, as soon as the client clicks create generate the "current/ano_number".
– Henrique Max
Generating the number is relatively simple, the problem is the requirements. Is it a real system? If yes, operates at what times? Can the sequence have holes? ex.: 001/2015, 003/2015 ?
– Alex Takitani