I am new to rails so sorry if this is easy. I am wondering the best way to upload pictures and display them in Ruby on Rails. I have a blog and would like to have the option of attaching a picture when creating a post.
I am new to rails so sorry if this is easy. I am wondering the best way to upload pictures and display them in Ruby on Rails. I have a blog and would like to have the option of attaching a picture when creating a post.
For anyone checking this question recently, Rails 5.2+ now has ActiveStorage by default & I highly recommend checking it out.
Since it is part of the core Rails 5.2+ now, it is very well integrated & has excellent capabilities out of the box (still all other well-known gems like Carrierwave, Shrine, paperclip,... are great but this one offers very good features that we can consider for any new Rails project)
Paperclip team deprecated the gem in favor of the Rails ActiveStorage.
Here is the github page for the ActiveStorage & plenty of resources are available everywhere
Please note that some advanced features are not available in ActiveStorage, but if your use case is simple, it can be one of the easiest uploading gems to install & integrate with 3rd party cloud storage (s3, digital ocean spaces, ....)
One of the main drawbacks for example, is that you can't define paths for your uploads in ActiveStorage, there is a hack to do that, so that each environment will upload to a different path (but still that was a big annoyance for me)
If your upload needs more flexibility & advanced features, I recommend checking out Shrine
Shrine comparison with other gems, as per their official page