[openstreetmap/openstreetmap-website] Create an ApplicationRecord for models to inherit from (#2447)

Andy Allan notifications at github.com
Wed Nov 27 10:58:41 UTC 2019


This is the default for Rails 5+, and also paves the way for multiple database support.

This is needed for multiple databases for two reasons. Firstly, it allows us to define the read/write database connections in one place. But more importantly, [from the docs](https://guides.rubyonrails.org/active_record_multiple_databases.html):

> It's important to connect to your database in a single model and then inherit from that model for the tables rather than connect multiple individual models to the same database. Database clients have a limit to the number of open connections there can be and if you do this it will multiply the number of connections you have since Rails uses the model class name for the connection specification name.

I've enabled the rubocop cop for this too, so that we don't use ActiveRecord::Base by mistake in PRs etc.
You can view, comment on, or merge this pull request online at:

  https://github.com/openstreetmap/openstreetmap-website/pull/2447

-- Commit Summary --

  * Create an ApplicationRecord for models to inherit from

-- File Changes --

    M .rubocop.yml (3)
    M app/models/acl.rb (2)
    A app/models/application_record.rb (3)
    M app/models/changeset.rb (2)
    M app/models/changeset_comment.rb (2)
    M app/models/changeset_tag.rb (2)
    M app/models/client_application.rb (2)
    M app/models/diary_comment.rb (2)
    M app/models/diary_entry.rb (2)
    M app/models/diary_entry_subscription.rb (2)
    M app/models/friendship.rb (2)
    M app/models/issue.rb (2)
    M app/models/issue_comment.rb (2)
    M app/models/language.rb (2)
    M app/models/message.rb (2)
    M app/models/node.rb (2)
    M app/models/node_tag.rb (2)
    M app/models/note.rb (2)
    M app/models/note_comment.rb (2)
    M app/models/oauth_nonce.rb (2)
    M app/models/oauth_token.rb (2)
    M app/models/old_node.rb (2)
    M app/models/old_node_tag.rb (2)
    M app/models/old_relation.rb (2)
    M app/models/old_relation_member.rb (2)
    M app/models/old_relation_tag.rb (2)
    M app/models/old_way.rb (2)
    M app/models/old_way_node.rb (2)
    M app/models/old_way_tag.rb (2)
    M app/models/redaction.rb (2)
    M app/models/relation.rb (2)
    M app/models/relation_member.rb (2)
    M app/models/relation_tag.rb (2)
    M app/models/report.rb (2)
    M app/models/trace.rb (2)
    M app/models/tracepoint.rb (2)
    M app/models/tracetag.rb (2)
    M app/models/user.rb (2)
    M app/models/user_block.rb (2)
    M app/models/user_preference.rb (2)
    M app/models/user_role.rb (2)
    M app/models/user_token.rb (2)
    M app/models/way.rb (2)
    M app/models/way_node.rb (2)
    M app/models/way_tag.rb (2)

-- Patch Links --

https://github.com/openstreetmap/openstreetmap-website/pull/2447.patch
https://github.com/openstreetmap/openstreetmap-website/pull/2447.diff

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/openstreetmap/openstreetmap-website/pull/2447
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstreetmap.org/pipermail/rails-dev/attachments/20191127/1cbb09af/attachment.html>


More information about the rails-dev mailing list