]> git.openstreetmap.org Git - rails.git/blobdiff - app/controllers/message_controller.rb
Split the createuniquenodes query in two as MySQL was choosing a very
[rails.git] / app / controllers / message_controller.rb
index 9b678e274aa06b526471811cd56c7a5d39847c2e..f52274cd06e2c5dad64e2bfdb0a8c2234d0afe0f 100644 (file)
@@ -29,12 +29,11 @@ class MessageController < ApplicationController
 
   def read
     @title = 'read message'
-    if params[:message_id]
-      id = params[:message_id]
-      @message = Message.find_by_id(id)
-      @message.message_read = 1
-      @message.save
-    end
+    @message = Message.find(params[:message_id], :conditions => ["to_user_id = ?", @user.id])
+    @message.message_read = 1
+    @message.save
+  rescue ActiveRecord::RecordNotFound
+    render :nothing => true, :status => :not_found
   end
 
   def inbox