Closed technologythree closed 10 years ago
Also having this problem with master (3.0.0.dev
) using normal file storage.
I think this is due the the removal of protected_attributes
at https://github.com/refinery/refinerycms-page-images/commit/28d7f79acc28859d52892d279c7f56fdf9d0967c
As the strong parameters
in the page controller (https://github.com/refinery/refinerycms/blob/master/pages/app/controllers/refinery/admin/pages_controller.rb#L105) would ignore the images_attributes
params now?
I'll have a look into it a bit more today.
Yep, it will need to be updated to allow strong parameters.. probably we need to decorate the admin pages controller with something like this but specific to these parameters and not the example in the comment.
Okay I've worked it out,
strong_parameters
didn’t like the -1 hack your using in the form to remove the images.
So if remove your -1 hidden field and do this:
Refinery::Admin::PagesController.class_eval do
def page_params_with_page_image_params
page_image_params = params.require(:page).permit(
images_attributes: [:id, :caption]
)
page_image_params = {images_attributes:{}} if page_image_params[:images_attributes].nil?
page_image_params.merge(page_params_without_page_image_params)
end
alias_method_chain :page_params, :page_image_params
end
It all works :)
I will create a PR now.
I have testet every Fix but nothing works... i have installed the Master Branch...
Any ideas?
Anyone got this working on Rails 4 and S3?
I am able to upload files without any errors. I also do not get any errors when the user saves the page.
But all the image captions and settings don't save in the database when you go and edit that page again.
Any ideas?