[openstreetmap/openstreetmap-website] Enable scrollable pagination for changeset elements (PR #6316)

Anton Khorev notifications at github.com
Wed Aug 13 02:02:11 UTC 2025


@AntonKhorev commented on this pull request.



> +    @ways = @changeset.old_ways
+                      .order(:way_id, :version)
+                      .offset(ELEMENTS_PER_PAGE * (@current_way_page - 1))
+                      .limit(ELEMENTS_PER_PAGE)
+  end
+
+  def load_relations
+    @relations_count = @changeset.actual_num_changed_relations
+    @current_relation_page = params[:relation_page].to_i.clamp(1, element_pages_count(@relations_count))
+    @relations = @changeset.old_relations
+                           .order(:relation_id, :version)
+                           .offset(ELEMENTS_PER_PAGE * (@current_relation_page - 1))
+                           .limit(ELEMENTS_PER_PAGE)
+  end
+
+  helper_method def element_pages_count(elements_count)

`def` returns a symbol. Rails' documentation of `helper_method` [predates](https://github.com/rails/rails/commit/e976c489e6416cdc4714721df78dd43dd6d13d99) [that](https://stackoverflow.com/a/26216164).

Do you want an extra line of code for `helper_method` separate from the method itself?

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

Message ID: <openstreetmap/openstreetmap-website/pull/6316/review/3113731944 at github.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstreetmap.org/pipermail/rails-dev/attachments/20250812/d5f7ca1d/attachment.htm>


More information about the rails-dev mailing list