diff options
author | Sean Griffin <sean@seantheprogrammer.com> | 2015-09-25 07:52:37 -0600 |
---|---|---|
committer | Sean Griffin <sean@seantheprogrammer.com> | 2015-09-25 07:54:38 -0600 |
commit | 37661bfc810da7384ac6650d60be8669baa16813 (patch) | |
tree | db005f8a472a46f19ef5be12e61fe98323f1d69b /activemodel/lib/active_model/validations/inclusion.rb | |
parent | 73eec7ac4008c178b6cacf71a20457fcfbe7c515 (diff) | |
download | rails-37661bfc810da7384ac6650d60be8669baa16813.tar.gz rails-37661bfc810da7384ac6650d60be8669baa16813.tar.bz2 rails-37661bfc810da7384ac6650d60be8669baa16813.zip |
`validates_acceptance_of` shouldn't require a database connection
The implementation of `attribute_method?` on Active Record requires
establishing a database connection and querying the schema. As a general
rule, we don't want to require database connections for any class macro,
as the class should be able to be loaded without a database (e.g. for
things like compiling assets).
Instead of eagerly defining these methods, we do it lazily the first
time they are accessed via `method_missing`. This should not cause any
performance hits, as it will only hit `method_missing` once for the
entire class.
Diffstat (limited to 'activemodel/lib/active_model/validations/inclusion.rb')
0 files changed, 0 insertions, 0 deletions