Add has_secure_token to Active Record

I take the audacity of include has_scure_token to Active Model since the implementation is using methods that are implemented in most of popular ORMs or ODMs in ruby, like `exists?`and `save`, is just as suggestion and for sure I'm open to move it to Active Record anyway :smile:. Is still missing documentation but I'd like to hear first opinions about the implementation/code

**Usage**

```ruby
class User < ActiveRecord::Base
  has_secure_token :token1, :token2, key_length: 30
end

user = User.new
user.save
user.token1 # => "973acd04bc627d6a0e31200b74e2236"
user.token2 # => "e2426a93718d1817a43abbaa8508223"
user.regenerate_token1! # => true
user.regenerate_token2! # => true
```

ref #16879

cc @dhh 
This isn't right. This will raise an exception on the first collision. It's supposed to not raise an exception until the 10th time it still produces a collision. 


> On Dec 28, 2014, at 09:47, Roberto Miranda <notifications@github.com> wrote:
> 
> In activerecord/lib/active_record/secure_token.rb:
> 
> > +      #   user.save
> > +      #   user.token # => "44539a6a59835a4ee9d7b112"
> > +      #   user.regenerate_token # => true
> > +      def has_secure_token(attribute = :token)
> > +        # Load securerandom only when has_secure_key is used.
> > +        define_method("regenerate_#{attribute}") { update! attribute => self.class.generate_unique_secure_token(attribute) }
> > +        before_create { self.send("#{attribute}=", self.class.generate_unique_secure_token(attribute)) }
> > +      end
> > +
> > +      def generate_unique_secure_token(attribute)
> > +        require 'securerandom'
> > +        10.times do
> > +          random_token = SecureRandom.hex(12)
> > +          return random_token unless exists?(attribute => random_token)
> > +        end
> > +        raise "Couldn't generate a unique token in 10 attempts!"
> Done 
> 
> —
> Reply to this email directly or view it on GitHub.
>