From: Tom Hughes Date: Fri, 9 Mar 2012 00:34:16 +0000 (+0000) Subject: Fix mass assignment issues X-Git-Tag: live~5052^2~115 X-Git-Url: https://git.openstreetmap.org/rails.git/commitdiff_plain/6f88f4d03fbe43b7005921192589966dd589affe?ds=sidebyside Fix mass assignment issues --- diff --git a/app/controllers/note_controller.rb b/app/controllers/note_controller.rb index 4c0c98b63..4c6ede6be 100644 --- a/app/controllers/note_controller.rb +++ b/app/controllers/note_controller.rb @@ -344,7 +344,7 @@ private attributes[:author_name] = name + " (a)" end - note.comments.create(attributes) + note.comments.create(attributes, :without_protection => true) note.comments.map { |c| c.author }.uniq.each do |user| if user and user != @user diff --git a/app/models/note.rb b/app/models/note.rb index 9531e2899..c32b1679b 100644 --- a/app/models/note.rb +++ b/app/models/note.rb @@ -14,6 +14,8 @@ class Note < ActiveRecord::Base validates_inclusion_of :status, :in => ["open", "closed", "hidden"] validate :validate_position + attr_accessible :lat, :lon + after_initialize :set_defaults # Sanity check the latitude and longitude and add an error if it's broken