[openstreetmap/openstreetmap-website] Add Messages API (PR #4605)

Milan Cvetkovic notifications at github.com
Fri Mar 22 15:45:27 UTC 2024


@milan-cvetkovic commented on this pull request.



> +
+      # Return a copy of the message
+      respond_to do |format|
+        format.xml { render :action => :show }
+        format.json { render :action => :show }
+      end
+    end
+
+    private
+
+    def show_messages
+      if params[:min_id]
+        @messages = @messages.where("id >= ?", params[:min_id]) unless params[:min_id] == "0"
+        @messages = @messages.order(:id => :asc)
+      else
+        @messages = @messages.where("id <= ?", params[:max_id]) unless params[:max_id].nil? || params[:max_id] == "0"

I am open to suggestions.

Maybe it would be enough to simply use missing `max_id` as `get the latest in descending order`

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

Message ID: <openstreetmap/openstreetmap-website/pull/4605/review/1955153668 at github.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstreetmap.org/pipermail/rails-dev/attachments/20240322/5dc63bcc/attachment-0001.htm>


More information about the rails-dev mailing list