Position not updating on save of page #13

bchiha opened this Issue Nov 9, 2011 · 0 comments

1 participant


When re-ordering attachments while editing a page using the 'drag/drop/js' feature, the new order isn't updated. The client works correctly by updating the hidden position fields, but when submitted, the server attempts to save the update but it returns

WARNING: Can't mass-assign these protected attributes: position

To fix this, I've added position to the attr_accessible list in page_attachments.rb

diff --git a/vendor/extensions/page_attachments/app/models/page_attachment.rb b/
index f8162cb..bd95515 100644
--- a/vendor/extensions/page_attachments/app/models/page_attachment.rb
+++ b/vendor/extensions/page_attachments/app/models/page_attachment.rb
@@ -14,7 +14,7 @@ class PageAttachment < ActiveRecord::Base
              :foreign_key => 'updated_by'
   belongs_to :page

-  attr_accessible :title, :description
+  attr_accessible :title, :description, :position

   def full_filename(thumbnail = nil)
           file_system_path = (thumbnail ? thumbnail_class : self).attachment_op

Not sure if this is 100% correct, but it works

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment