[openstreetmap/openstreetmap-website] Adds optional use of notes records (PR #5511)

Anton Khorev notifications at github.com
Tue Jan 28 08:04:42 UTC 2025


@AntonKhorev commented on this pull request.



>    def author
-    comments.first.author
-  end
-
-  # Return the note's author ID, derived from the first comment
-  def author_id
-    comments.first.author_id
-  end
-
-  # Return the note's author IP address, derived from the first comment
-  def author_ip
-    comments.first.author_ip
+    if user_ip.nil? && user_id.nil?
+      all_comments.first.author
+    else
+      association(:author).reader

Is this going to work?

```suggestion
      super
```

`association` is [not documented](https://github.com/rails/rails/blob/cf6ff17e9a3c6c1139040b519a341f55f0be16cf/activerecord/lib/active_record/associations.rb#L51).

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

Message ID: <openstreetmap/openstreetmap-website/pull/5511/review/2577387803 at github.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstreetmap.org/pipermail/rails-dev/attachments/20250128/69613c0f/attachment.htm>


More information about the rails-dev mailing list