thetron/mongoid_token — Issue #5: ActiveSupport::SecureRandom deprecation warnings in Rails 3.1.0
Author: impact11
Created: 2011-11-09 14:29:02+00:00
State: open

Given the following model:

```ruby
class ATest
include Mongoid::Document
include Mongoid::Token

field :name, :type => String
field :is_true, :type => Boolean

token :length => 3
validates :name, :presence => true
end
```

And the following spec:

```ruby
require 'spec_helper'

describe ATest do
describe 'draft style' do
it 'is required' do
style = ATest.create(:name => nil, :is_true => false)
style.should have(1).errors_on(:name)

style.name = 'Test Value'
style.should have(:no).errors_on(:name)
end

it 'can be false' do
style = ATest.create(:name => "Tournament", :is_true => true)
style.should have(:no).errors_on(:name)
end
end
end
```

then you'll receive the following warning from rspec:

DEPRECATION WARNING: ActiveSupport::SecureRandom is deprecated! Use SecureRandom instead.

If you comment out the Mongoid::Token inclusion, the warning goes away.

We are using Mongoid ~2.3, sorcery ~0.7 and rails 3.1.0

I have tried to find in the mongoid_token source where there are calls to ActiveSupport::SecureRandom methods, but have not been able to trace them down.

Any guidance would be appreciated.