[openstreetmap/openstreetmap-website] Lazy loading relation members (PR #6326)
Tom Hughes
notifications at github.com
Tue Aug 19 21:21:21 UTC 2025
tomhughes left a comment (openstreetmap/openstreetmap-website#6326)
So I tried adding associations to node/way/relation along these lines:
```ruby
has_many :element_tags, :class_name => "NodeTag"
```
and with all three in place I could then do:
```ruby
Relation.preload(:relation_tags, :relation_members => { :member => :element_tags }).find(2)
```
and it would preload everything.
So as I suspected we just need to rename the associations to have a common name and it should all work.
Note that the old models already have a common name (`old_tags`) so this should already work there.
--
Reply to this email directly or view it on GitHub:
https://github.com/openstreetmap/openstreetmap-website/pull/6326#issuecomment-3202276027
You are receiving this because you are subscribed to this thread.
Message ID: <openstreetmap/openstreetmap-website/pull/6326/c3202276027 at github.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstreetmap.org/pipermail/rails-dev/attachments/20250819/4d0c4b08/attachment.htm>
More information about the rails-dev
mailing list