How do I upload images and zip files in RoR? I am a newbie. So please help. Give me both the view and the controller code example.
Thanks in advance.
Seeding Images in Your Rails Database Rails also enables users to seed the database with images if they want. To do so, you can use the 'attach' method, passing in a hash with two keys. The 'io' key calls the open method on the File class and takes the image's relative path as an argument.
1 What is Active Storage? Active Storage facilitates uploading files to a cloud storage service like Amazon S3, Google Cloud Storage, or Microsoft Azure Storage and attaching those files to Active Record objects.
Active Storage uses two tables in your application's database named active_storage_blobs and active_storage_attachments . After creating a new application (or upgrading your application to Rails 5.2), run rails active_storage:install to generate a migration that creates these tables.
Nav,
Try the paperclip plugin, you can read about it here http://www.thoughtbot.com/projects/paperclip
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With