X-Git-Url: https://git.openstreetmap.org/rails.git/blobdiff_plain/f0feca800d91ac1d23eb63ca17a45d8fd4d41920..be7cc77397ac22e4914ab6ea3416644c46bfa1b3:/app/models/note.rb?ds=sidebyside diff --git a/app/models/note.rb b/app/models/note.rb index 67222191d..9dc122721 100644 --- a/app/models/note.rb +++ b/app/models/note.rb @@ -1,10 +1,7 @@ class Note < ActiveRecord::Base include GeoRecord - has_many :comments, :class_name => "NoteComment", - :foreign_key => :note_id, - :order => :created_at, - :conditions => { :visible => true } + has_many :comments, -> { where(:visible => true).order(:created_at) }, :class_name => "NoteComment", :foreign_key => :note_id validates_presence_of :id, :on => :update validates_uniqueness_of :id