• S
    `validates_acceptance_of` shouldn't require a database connection · 37661bfc
    Sean Griffin 提交于
    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.
    37661bfc
acceptance.rb 3.6 KB