1

extend from here

There he just wanted to custom the attribute's name. I tried I18n, also read out the whole railsguide about I18n searching for help that I need, seems nothing.....

It seems when having has_secure_password in user.rb, 3 validates automatedly required.

  1. password can't be blank, raise "[attributes] can't be blank" message
  2. password_confirmation can't be blank, raise above
  3. password and password_confirmation doesn't match, raise "[attribute A] Doesn't Match [attribute B]"

Customize above three, how? I’ve tried to find through all project text for "can't be blank" or "doens't match" key words. Nothing work out.

All the possibilities online Been there done that,desperately need your help

Community
  • 1
  • 1
CoolDrinE
  • 11
  • 7
  • https://github.com/rails/rails/blob/869a90512f36b04914d73cbf58317d953caea7c5/activemodel/lib/active_model/secure_password.rb#L74 – lcguida Nov 04 '15 at 16:00
  • Those seems to be the validations he adds – lcguida Nov 04 '15 at 16:01
  • @lcguida thx, through still don't what to do with it to reach my needs. And I've just fixed that by I18n. It is pretty strict to the format... god, almost costs my whole day on it – CoolDrinE Nov 04 '15 at 16:13
  • This answer might help you - http://stackoverflow.com/questions/31762587/custom-error-message-for-password-presence-validation – leviathan Jan 26 '17 at 07:46

1 Answers1

0

I thought I18n doesnt work through has_secure_password framework, but it actually does. Please re-check the format in the /config/locale/*.yml file!

CoolDrinE
  • 11
  • 7