rails/rails — pull request #14494 by laurocaetano (2014-03-27 01:38:38+00:00)
Title: Add a test case for save(validate: false) with invalid foreign key.

This PR adds a test case for the behavior described by #6659.

Lets suppose I have the following scenario:

```ruby
class User < ActiveRecord::Base
has_many :accounts
end

class Account < ActiveRecord::Base
belongs_to :user
end

account = Account.new
account.user = User.last
account.user_id = 12312312312 # lets suppose that this id does not exist in the database

account.save(validate: false)
# expected to raise ActiveRecord::InvalidForeignKey
# if I have a fk constraint in the database
```

This test case is green, so the behavior is correct.