Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How can I save images to a specific folder? #3

Open
aaongr opened this issue May 15, 2019 · 1 comment
Open

How can I save images to a specific folder? #3

aaongr opened this issue May 15, 2019 · 1 comment

Comments

@aaongr
Copy link

aaongr commented May 15, 2019

I would like to upload the images in a specific folder and not in the root of the cloudinary space...
Any ideas how can I do this?

@aaongr
Copy link
Author

aaongr commented May 16, 2019

I just had to override the public_id method. In config/initializers/solidus_cloudinary.rb:

module Cloudinary::CarrierWave
  def public_id
    # TODO: add/upload second file does not work! needs refresh page!
    return "#{Rails.application.class.parent_name.downcase}/#{File.basename(@filename.downcase, File.extname(@filename.downcase))}-#{Cloudinary::Utils.random_public_id}"
  end
end

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant