------art_30404_17306238.1147448040135
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: quoted-printable
Content-Disposition: inline

Once again, I come up with something better two minutes after I hit send.

class String
  def inc
    parts = scan(/^(.*\D)?(\d+)?$/).first
    "#{parts.first}#{parts.last.to_i + 1}"
  end
end

On 12/05/06, Human Dunnil <h.dunnil / gmail.com> wrote:
>
> Hello,
> I have model which has a property named "name", I want to append a
> number to the end of the name when there is similar name in db.
>
> name, name1, name2...
>
> Is there a ready to use method in ruby and/or rails for doing so?
>
> Thanks in advance,
> - Dunnil
>
>

------art_30404_17306238.1147448040135--