validates :agree_to_contract, :acceptance => { :accept => true }, :on => :update, :if => :signer_full_name
agree_to_contract is a boolean, and signer_full_name is a string. I wanted the two fields to depend upon each other, and fail if one of them did not exist (there was a similar validation on signer_full_name for going in the other direction).
None of my initializers accessed the model which contained these validations, but yet - there was no way for me to remedy the issue. I attempted to wrap the validation in an ActiveSupport.on_load do end; still, the error persisted. This method seemed to be the culprit. It appeared as though the :acceptance block on the validation was causing the issue, but I was pretty much out of information to gather, so I headed over to the Rails issues tracker, to report a bug. After a bit of deliberation, and me producing some sample apps that displayed said behavior, it turned out that that this is, indeed, a bug. The cause is presently unknown, however, one of the contributors to the post hypothesized that the cause was eager_load! Hopefully the issue is resolved soon, and we can deploy checkboxes with validations to our heart's content ;)
Update:
A fix has been proposed, and it's working in my app! It's a pretty simple fix, too. edit config/environments/production.rb in your own app with the following:
replace
config.eager_load = true
with config.eager_load = true if config.eager_load.nil?
That's it. You should no longer have precompiling assets break with the :acceptance validation.