mardi 7 janvier 2020

Generate random numbers on input fields

I'm building a little app for my kid. Sort of a real simple D&D thing. I'm wondering if there is a way to generate a random number as an input field. Something like:

f.text_field :health = rand(1-20) + 20

I could do it in the controller and just have it display but I'd like to have it as an input field if that is possible?




Aucun commentaire:

Enregistrer un commentaire