• G
    Introduce ApplicationRecord, an Active Record layer supertype · 2067fff9
    Genadi Samokovarov 提交于
    It's pretty common for folks to monkey patch `ActiveRecord::Base` to
    work around an issue or introduce extra functionality. Instead of
    shoving even more stuff in `ActiveRecord::Base`, `ApplicationRecord` can
    hold all those custom work the apps may need.
    
    Now, we don't wanna encourage all of the application models to inherit
    from `ActiveRecord::Base`, but we can encourage all the models that do,
    to inherit from `ApplicationRecord`.
    
    Newly generated applications have `app/models/application_record.rb`
    present by default. The model generators are smart enough to recognize
    that newly generated models have to inherit from `ApplicationRecord`,
    but only if it's present.
    2067fff9
app_generator_test.rb 22.4 KB