Build a Blog with Rails Part 17: Handling File Uploads with ActiveStorage & Amazon S3

Sdílet
Vložit
  • čas přidán 2. 04. 2023
  • ► Check out gorails.com for Pro episodes and more!
    ► SaaS business template for Ruby on Rails with built-in features like Payments, Teams, and much more: jumpstartrails.com
    ► Ruby on Rails hosting with Hatchbox.io: hatchbox.io
    ► Learn how to add Stripe Payments (with SCA support!) with Ruby on Rails: courses.gorails.com/payments-...
  • Věda a technologie

Komentáře • 27

  • @klnmn3722
    @klnmn3722 Před 12 dny +1

    Set this up with no issues, awesome tutorial. I actually smiled when you talked about how difficult it was because you made it seem so easy. Deeply appreciate all the help you put out in this series for free!

  • @cakeintech
    @cakeintech Před rokem +3

    Awesome! You have no idea how much your video content has come to my rescue! Your explanation of active storage with Amazon S3 was top-notch and incredibly helpful. Thank you so much!

  • @olegmitnik9617
    @olegmitnik9617 Před 10 měsíci +2

    It was hard but I've gone through this! Thank you! 💯👍 GoRails🚀

  • @LibertarianSeeker
    @LibertarianSeeker Před 6 měsíci +1

    Great series! Thanks so much!

  • @oli2016
    @oli2016 Před rokem +2

    Just used this in the wild, thanks Chris

    • @GorailsTV
      @GorailsTV  Před rokem

      Excellent! Hope it went smoothly!

  • @PurelyDef
    @PurelyDef Před 10 měsíci +1

    This was what i was looking for, thank you!
    I’m using rails as a backend and returning a link to my images to render in my react app. What’s the correct way to get the s3 url?
    I originally used rails_blob_path when everything was local, but I believe object.image.url is the way to get the s3 link. But I saw someone say that the predecessor to this, object.image.service_url was frowned upon. Is that still the case?

  • @user-zo4jw9gm8j
    @user-zo4jw9gm8j Před 5 měsíci

    Hello and thanks for the video! Question: Where all the other files of your database are stored. Like the text of the posts not only the images or users data?

    • @GorailsTV
      @GorailsTV  Před 5 měsíci

      Depends on your database but they will always store it on disk in the databases data directory.

    • @user-zo4jw9gm8j
      @user-zo4jw9gm8j Před 5 měsíci

      So, do you need another s3 bucket for example users credentials or they stored in a postgres database?

  • @totesdrunk
    @totesdrunk Před 11 měsíci

    Your videos are always so informative and helpful! Seriously you do so much for the community. Question - have you tried to do this same approach, but using a policy on an IAM role that is assigned to the EC2 instance? This method won't create an access/secret key like you need in the storage.yml. This is useful given an environment where you can't create users. All my testing has been unsuccessful thus far :(

    • @GorailsTV
      @GorailsTV  Před 11 měsíci

      I think you always need keys to login.

    • @totesdrunk
      @totesdrunk Před 11 měsíci

      @@GorailsTV I was able to figure it out, well somewhat! In production it will work, but for local dev it won't work. For local dev it is just as you said where you need keys. In production though, you can omit the keys and as long as the IAM role is configured properly everything should work.

  • @MrJackrabbit101
    @MrJackrabbit101 Před 2 měsíci

    Hi! I am really enjoying your series so far. When I upload an image while editing a blog post, the image shows. When I update the blog post, the image doesn't show. Looking into the console, I am getting the following error" "ActiveStorage::Representations::RedirectController#show wrong number of arguments(given 1, expected 0) ". I made sure I had vips installed and tried installing different versions of image_processing (where the error comes from) and nothing has worked so far. Any help would be appreciated and thanks!

    • @GorailsTV
      @GorailsTV  Před 2 měsíci +1

      That's a good question. Share the full stacktrace if you get a chance.

  • @user-zo4jw9gm8j
    @user-zo4jw9gm8j Před 28 dny

    Hey go rails! I have a question If I use action text for some blog post. Since these blog posts are not many can instead of uploading files in Amazon s3, I can store them in my app? Thanks!!

    • @GorailsTV
      @GorailsTV  Před 28 dny

      You can use the file store but your hosting service would need persistent disk storage in production. So a place like Heroku wouldn't work because they run everything in containers but a hosting service like Hatchbox.io that we run does support persistent disk storage.

  • @MakeRandomVids
    @MakeRandomVids Před 3 měsíci

    If my app is to have users, and users uploading images under their account AND only owner of images can access/view the images - Will the ACL be disalbed?

  • @Mw-od6sd
    @Mw-od6sd Před 4 měsíci

    My god it’s Litteraly a hell storm just to connect the app to the damn bucket so frustrating

    • @GorailsTV
      @GorailsTV  Před 4 měsíci

      Good old Amazon for you!

    • @Mw-od6sd
      @Mw-od6sd Před 4 měsíci

      Hey I actually went through it slowly and finally got my rails app connected to the bucket . THANK YOU !

    • @Mw-od6sd
      @Mw-od6sd Před 4 měsíci

      But I need your help really badly I am having serious trouble now

    • @Mw-od6sd
      @Mw-od6sd Před 4 měsíci

      I tried sending the urls back to the frontend . And it’s not recognizing them and it’s crashing on frontend.
      I used rails_blob_path , rails_blob_url and more with disposition: “attached”
      Only sending the service url works but then it won’t download when plugged into the href (I have download attribute in href tag )
      HELP PLEASE !!!