Clip images are not saved in the path I set

im tring to save downloadable images using paperclip to a specific path. I would like the images to be saved in the app / assets / image directory in the ruby ​​on rails application, but they did not seem to go in there.

this is what the path in config / environment / development.rb looks like

config.paperclip_defaults = {
:url  => ":rails_root/app/assets/images/:attachment/:id/:style/:filename",    
:path => "/:class/:attachment/:id/:style/:basename.:extension"
}

I really appreciate any advice or help you can give me, if you need more information, I will try to do it as quickly as possible.

this creates a def from the product_images file showing how I create the image and save it

def create
 @product_image = ProductImage.new(params[:product_image])
 @product = @product_image.product

 if @product_image.save
  @product.product_image_id = @product_image.id
  @product.save

  redirect_to @product_image, notice: 'Product image was successfully created.'         
 else
  render :template => "products/edit"       
 end    
end
+1
source share
1 answer

, , , development.rb.

 has_attached_file :model_name,
 :path => ":attachment/:id/:style/:basename.:extension"
0

Source: https://habr.com/ru/post/1539698/


All Articles