X-Git-Url: https://git.openstreetmap.org./rails.git/blobdiff_plain/ca30b879f6eba3f513bcfa53545dba43d09b2023..aba79a5e3dba586d7762c353808f125476eb3d2d:/app/models/note.rb?ds=sidebyside diff --git a/app/models/note.rb b/app/models/note.rb index 9dc122721..27357e58a 100644 --- a/app/models/note.rb +++ b/app/models/note.rb @@ -11,6 +11,9 @@ class Note < ActiveRecord::Base validates_inclusion_of :status, :in => ["open", "closed", "hidden"] validate :validate_position + scope :visible, -> { where("status != 'hidden'") } + scope :invisible, -> { where("status = 'hidden'") } + after_initialize :set_defaults # Sanity check the latitude and longitude and add an error if it's broken