Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>I had a similar issue and eventually find the cause of the extra-attributes (in your case the :tag_list) not being saved on new image upload.</p> <p>If you look at <a href="https://github.com/resolve/refinerycms/blob/master/images/app/controllers/refinery/admin/images_controller.rb" rel="nofollow"><code>::Refinery::ImageController</code></a> you'll see that the create action actyally create the image with :</p> <pre><code>unless params[:image].present? and params[:image][:image].is_a?(Array) @images &lt;&lt; (@image = ::Refinery::Image.create(params[:image])) else params[:image][:image].each do |image| @images &lt;&lt; (@image = ::Refinery::Image.create(:image =&gt; image)) end end </code></pre> <p><code>params[:image][:image]</code> is an Array when multiple multiple file uploed is enabled (by default it is). But then the action only use take the array values when creating the images, ignoring the other params.</p> <p>I quickly write the below work-around that allow to save the other params on multiple image upload :</p> <pre><code>unless params[:image].present? and params[:image][:image].is_a?(Array) @images &lt;&lt; (@image = ::Refinery::Image.create(params[:image])) else images_params = params[:image].dup images_params.delete(:image) params[:image][:image].each do |image| @images &lt;&lt; (@image = ::Refinery::Image.create({:image =&gt; image}.merge(images_params))) end </code></pre> <p>end</p> <p>It's probably not the most elegant solution bu it does the trick.</p> <p>To use it in your app, you'll have to create a decorator for the <code>::Refinery::ImageController</code> to copy and edit the create action in it. (see 'Extending a Controller' in <a href="http://refinerycms.com/guides/extending-controllers-and-models-with-decorators" rel="nofollow">Refinery's Guides</a>) </p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload