且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

Ruby on rails - 回形针未保存到数据库

更新时间:2022-12-18 09:50:46

您是否使用 Resque 作为后台作业,如果是,那么您需要使用 rake resque:work QUEUE= 启动它'*'.in rails 通常 Resque 用于处理涉及邮寄和图片上传的后台作业.使用回形针配置 Amazon S3.

Are you using Resque for background job,if yes then u need to start it using rake resque:work QUEUE='*'.in rails usually Resque is used to handle background jobs which involves mailer and picture upload.OR an example below for product.html.erb having partial for photos upload for that product with paperclip configures with Amazon S3.

product.html.erb

product.html.erb

<%= render :partial => 'photos' %>

_photos.html.erb 至少需要一张图片

_photos.html.erb for atleast one image mandatory

       <% if @product.photos[0].nil? %>
                <a href="javascript:void(0);" class="add-photos" >
                <img src="/assets/default/product-add-photos.png" alt="Add product photos"/>              
                 </a>   
        <% end %>
 <img src="<%= (@product.product_photos[0].nil? ? "" : @product.photos[0].image.url(:small)) %>" id="photos_1" class="product-photos-src <%=@product.photos[0].nil? ? 'dontdisplay' : ''%> "/>