Closed shrkw closed 4 years ago
Sorry, this is due to multi byte encoding.
I can validate by name.force_encoding('utf-8').length
.
Sorry to bother you.
Hello,
What is the purpose of validating the length of the field?
On October 2, 2020, Khushhal Maheshwari notifications@github.com wrote:
Hi,
I want to validate length for encrypted filed. But standard way counts as byte length. So it does not work for
string length.
validates :name, length: { maximum: 80 } Do you have any idea for that?
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/jmazzi/crypt_keeper/issues/186, or unsubscribe https://github.com/notifications/unsubscribe- auth/AAAARYPN63EMVIABKWZ4K4TSIWMP7ANCNFSM4SBPEWRA.
I think it is common use case though, I don't want to accept too long name input to users. I added client side length validation, and I wanted to add it on rails side too.
Hi,
I want to validate length for encrypted filed. But standard way counts as byte length. So it does not work for string length.
Do you have any idea for that?