Added ActiveRecord::Base#has_secure_key (via ActiveRecord::Securekey)

This is how the API will look like.

- [X] Done Implementation. 
- [ ] Documentation's work is in progress

fixes #16879 
cc @dhh 
Timeout would simply be “as many SQL queries as we can fire off”, which doesn’t seem good. IMO, the MAX_TRIES should be tons lower anyway. More like 10-20. If it’s going above that, your UUID algo is fucked.

Anyway, we’re discussing also whether this is even necessary if the uuid algo is good enough. Maybe just having a unique table constraint is enough if it’s exceedingly rare to collide.

On Sep 15, 2014, at 9:21, Sean Griffin <notifications@github.com> wrote:

> In activerecord/lib/active_record/secure_key.rb:
> 
> > @@ -0,0 +1,44 @@
> > +module ActiveRecord
> > +  module SecureKey
> > +    extend ActiveSupport::Concern
> > +
> > +    MAX_TRIES = 1000
> 
> Actually, why not use Timeout for this, rather than a max number of retries?
> 
> —
> Reply to this email directly or view it on GitHub.
>