radiant/radiant-page-attachments-extension — Issue #13: Position not updating on save of page
Author: bchiha
Created: 2011-11-09 05:04:24+00:00
State: open

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
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