Ivan Raszl

Joined

4,720 Experience
42 Lessons Completed
0 Questions Solved

Activity

Posted in How to use Stripe Checkout in Rails Discussion

I have the same problem. I added the stripe public and private key, and also created and added the signing secret and the webook call by Stripe returns with a 404 from Heroku. Have you managed to solve this issue?

Posted in Rails view_components

+1

Posted in Docker Basics for Rails Discussion

I agree with Drazen. More Docker+Rails tutorials. Especially on how to deploy to production. Also, how to add sidekiq.

This is a great feature. However, one really needs to think twice about branching into different views for different variants. It increases development and testing time significantly.

I wonder how does caching works. Would you create a different key for each variant? Would you included the variant version in the key name?

Matias, thanks for saving me! :)

Posted in How to use Uppy with ActiveStorage Discussion

Thank you for doing this video. It's great.

Can you give pointers to how to implement multiple file upload fields on a single form? For example, if I wanted users to upload multiple images in one field and multiple videos in another field?

Posted in Install Bootstrap with Webpack with Rails 6 Beta

Locally it works, but when I push the code to Heroku the assets are not precompiled. No CSS or JS present apparently.

Do I need to add yarn add bootstrap@4.3.1 jquery popper.js to my Procfile or somewhere when deploying to Heroku?

Posted in How to handle long-running external services?

Some ideas to consider. Can you:

  • use cron (or scheduler) on Heroku to kick off the job regularly so the long running service is not taking so long?
  • break the long-running service up into smaller pieces?
  • dedicate a worker just for this long-running service so you don't mind it being tied up?
  • configure the external service so it pings you when the job is done?

Posted in How to write System Tests in Rails Discussion

Great lesson.

At 11:50 you show a bootstrap modal for confirmations. How do you build that to replace the browser modal that is by default generated for a typical delete button?

Posted in How to use Devise Test Helpers Discussion

Apparently, the industry is moving towards minitest. It makes sense because the strength of Rails is that you can develop faster if you use the standard tools and ways. Thus, generally using built in tools, like minitest, action cable, active storage, etc. is a good long term strategy.

Posted in Multiple File Uploads with a nice JS interface?

I don't have an answer for you, but I wonder why is it a problem that all the files are in a single folder. You database will pick the right file for you anyway. You're using a file server for your files, right? So the uploaded files are not mixed up with your Ruby files. Do you ever have to ftp into your file server to find a specific file?

In case somebody needs it. Here are the steps to make it work.

  1. Set up your S3 bucket. Use this CORS on the bucket: https://github.com/basecamp/trix/issues/128#issuecomment-523545259
  2. Allow List Objects, and Write Objects for the public. Not exactly safe, but it allows you to upload without presigning.
  3. Optionally add Cloudfront and allow POST.
  4. Take note of your Cloudfront URL.
  5. Add this to your https://trix-editor.org/js/attachments.js application.js
  6. Change the HOST to your cloudfront URL.

Posted in Rails 6.0 + Heroku + Active Storage + VIPS

Thank you!

I'll try to remove what you are unsure about and report back. What's wrong with that line?

I was able to fix the CSS/JS issue. I just had to comment out these in production.rb, probably because in Rails 6.0 things differently. Need to learn about this...

# config.assets.js_compressor = Uglifier.new(harmony: true)
# config.assets.css_compressor = :sass

Posted in Rails 6.0 + Heroku + Active Storage + VIPS

Thank you! I'm getting closer to a solution.

Buildpacks:

heroku buildpacks:add --index 1 heroku-community/apt
heroku buildpacks:add --index 2 https://github.com/brandoncc/heroku-buildpack-vips.git
heroku buildpacks:add --index 3 heroku/nodejs
heroku buildpacks:add --index 4 heroku/ruby

Add Aptfile to root with the following content:

libglib2.0-0
libglib2.0-dev
libpoppler-glib8

Add to Gemfile:
gem 'image_processing', '~> 1.2'

Example call from views:
post.image.variant(resize_to_fill: [500, 250, linear: true]).processed

The VIPS part now works with Heroku, but I'm still struggling with some bug. For some reason my CSS and JS files are not loading on Heroku, but they are loading fine locally.

How do I integrate Trix with ActiveStorage and AWS S3? Thank you!

Posted in Rails 6.0 + Heroku + Active Storage + VIPS

Thanks Chris. I was meaning to try out Hatchbox.

Posted in Rails 6.0 + Heroku + Active Storage + VIPS

VIPS is a 3x faster and 10x less memory hungry image processor that is now available for Active Storage in Rails 6.0. Unfortunately By default Heroku doesn't support VIPS. Do you know of a working buildpack you tested that has VIPS support?

What do you expect the output to be? A web page? If yes, you need to:

  • Put all of this code into a controller, and instead of 'puts', assign the results to an array that contains all the data you want to output.
  • Create a view that displays the content of your array.

Great episode. I never knew you can add an array for columns into an index!

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

© 2024 GoRails, LLC. All rights reserved.