I’d like to gauge interest in adding support for different column names for ActiveModel::SecurePassword. Currently, has_secure_password assumes that the column name for the attribute you want to encrypt is simply “password.” Obviously, this may not always be the column name of the data you’re trying to encrypt and it would be nice to be able to optionally specify the appropriate column name. I’m willing to investigate this if there’s interest from the Core team.
I’d like to gauge interest in adding support for different column names for ActiveModel::SecurePassword. Currently, has_secure_password assumes that the column name for the attribute you want to encrypt is simply “password.” Obviously, this may not always be the column name of the data you’re trying to encrypt and it would be nice to be able to optionally specify the appropriate column name.
I am curious, what is your use case? What is that data and what is the column name?
My use case is hashing a token we need to store encrypted in our database. However, as I started to ponder the possible implementation some more, I came to the conclusion that a more generic has_secure_attribute method might be a better solution. Unless the committers want to maintain a new API method, it probably makes sense for me to just throw that into a gem of my own making. Feedback is welcome, though.
Actually, that implementation is slightly different than what I had in mind - in my use case, we already have a token generated, but we need to encrypt it. The implementation I have in mind would essentially reuse the BCrypt encryption stuff in has_secure_password.