]> git.openstreetmap.org Git - rails.git/blobdiff - app/controllers/browse_controller.rb
Convert some deprecated methods to modern arel syntax
[rails.git] / app / controllers / browse_controller.rb
index 5526aacca05df6de55bb8c7087662dcaea829db2..705078be7ba36e08a146b1c715130e7ad4ed13ca 100644 (file)
@@ -27,7 +27,7 @@ class BrowseController < ApplicationController
   
   def way
     @type = "way"
-    @way = Way.find(params[:id], :include => [:way_tags, {:changeset => :user}, {:nodes => [:node_tags, {:ways => :way_tags}]}, :containing_relation_members])
+    @way = Way.preload(:way_tags, :containing_relation_members, :changeset => :user, :nodes => [:node_tags, :ways => :way_tags]).find(params[:id])
     @next = Way.visible.where("id > ?", @way.id).order("id ASC").first
     @prev = Way.visible.where("id < ?", @way.id).order("id DESC").first
   rescue ActiveRecord::RecordNotFound
@@ -36,7 +36,7 @@ class BrowseController < ApplicationController
   
   def way_history
     @type = "way"
-    @way = Way.find(params[:id], :include => [:way_tags, {:old_ways => {:changeset => :user}}])
+    @way = Way.preload(:way_tags, :old_ways => { :changeset => :user }).find(params[:id])
   rescue ActiveRecord::RecordNotFound
     render :action => "not_found", :status => :not_found
   end
@@ -80,8 +80,9 @@ class BrowseController < ApplicationController
   def note
     @type = "note"
     @note = Note.find(params[:id])
-    @next = Note.find(:first, :order => "id ASC", :conditions => [ "status != 'hidden' AND id > :id", { :id => @note.id }] )
-    @prev = Note.find(:first, :order => "id DESC", :conditions => [ "status != 'hidden' AND id < :id", { :id => @note.id }] )
+    @title = "#{I18n.t('browse.note.title')} | #{@note.id}"
+    @next = Note.where("status != 'hidden' AND id > ?", @note.id).order(:id).first
+    @prev = Note.where("status != 'hidden' AND id < ?", @note.id).order(:id => @desc).first
   rescue ActiveRecord::RecordNotFound
     render :action => "not_found", :status => :not_found
   end