I have a method in a model with Rails. This is the code:
def ensure_appropriate_age
age = match[:age]
if age[/\d/].to_i > 18
current_user.update age: age[/\d/].to_i
else
%{We could not proceed, sorry.}
end
end
I'm taking the input of what the user types and if it contains a number, verify that it is greater than 18 to store it.
I'll enter my age like so: im 24. I still get false, and I can see in the database it's only storing the number "2".
What is required to make this work?