[openstreetmap/openstreetmap-website] Enable active_record.belongs_to_required_by_default (PR #3470)

Tom Hughes notifications at github.com
Wed Feb 23 20:35:00 UTC 2022


@tomhughes commented on this pull request.



> @@ -32,9 +32,9 @@
 
 class Issue < ApplicationRecord
   belongs_to :reportable, :polymorphic => true
-  belongs_to :reported_user, :class_name => "User"
-  belongs_to :user_resolved, :class_name => "User", :foreign_key => :resolved_by
-  belongs_to :user_updated, :class_name => "User", :foreign_key => :updated_by
+  belongs_to :reported_user, :class_name => "User", :optional => true
+  belongs_to :user_resolved, :class_name => "User", :foreign_key => :resolved_by, :optional => true
+  belongs_to :user_updated, :class_name => "User", :foreign_key => :updated_by, :optional => true

Look like the initial report doesn't count so this can be null.

-- 
Reply to this email directly or view it on GitHub:
https://github.com/openstreetmap/openstreetmap-website/pull/3470#discussion_r813293938
You are receiving this because you are subscribed to this thread.

Message ID: <openstreetmap/openstreetmap-website/pull/3470/review/891648762 at github.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstreetmap.org/pipermail/rails-dev/attachments/20220223/903a5a20/attachment.htm>


More information about the rails-dev mailing list