Ask A Question

Notifications

You’re not receiving notifications from this thread.

How can I upload a file from the console

Fugee Ohu asked in Rails

I'm trying to write a controller action that will create records with attachments from a form submission where the form has multiple true set for the file_field I wanna take the params from the form like caption and create a new record for each of the multiple files selected with the same caption but a different image so I'd be iterating through the selected files and creating a new record for each one I have to admit this may not be a good idea, it's a has_many_through setup allowing users to click on images to see records from associated tables It made sense for my old west site where pictures are significant but now I'm using the same code copied to on an e-commerce site I have to admit it's a pain but I wanna get a handle on it before migrating to a different approach so for the time being to help me write my controller action I wanna work out the core functions in console so my question is how do I upload a file from the console

Reply
Join the discussion

Want to stay up-to-date with Ruby on Rails?

Join 73,723+ developers who get early access to new tutorials, screencasts, articles, and more.

    We care about the protection of your data. Read our Privacy Policy.

    Screencast tutorials to help you learn Ruby on Rails, Javascript, Hotwire, Turbo, Stimulus.js, PostgreSQL, MySQL, Ubuntu, and more. Icons by Icons8

    © 2023 GoRails, LLC. All rights reserved.