app/controllers/spina/admin/attachments_controller.rb in spina-0.9.0 vs app/controllers/spina/admin/attachments_controller.rb in spina-0.10.0
- old
+ new
@@ -22,24 +22,26 @@
@attachment.destroy
redirect_to spina.admin_attachments_url
end
def select
- @attachments = Attachment.file_attached.sorted
+ @selected_attachment_id = Attachment.find_by(id: params[:selected_attachment_id]).try(:id)
+ @attachments = Attachment.order_by_ids(@selected_attachment_id).file_attached.sorted
@attachment = Attachment.new
end
def insert
@attachment = Attachment.find(params[:attachment_id])
end
def select_collection
- @attachments = Attachment.file_attached.sorted
+ @selected_attachment_ids = Attachment.where(id: params[:selected_attachment_ids]).ids
+ @attachments = Attachment.order_by_ids(@selected_attachment_ids).file_attached.sorted
@attachment = Attachment.new
end
def insert_collection
- @attachments = Attachment.find(params[:attachment_ids])
+ @attachments = Attachment.where(id: params[:attachment_ids])
end
private
def set_breadcrumbs