John van Arkelen

Joined

8,210 Experience
80 Lessons Completed
0 Questions Solved

Activity

Posted in Inviting Users with devise_invitable Discussion

A bit late, but thanks for sharing Ariel!

Posted in Rails & Vue.js Trello Clone - Part 4 Discussion

Both the added and moved element now have the list_id, so that makes it easier.

Posted in Archive old pages to a static page

Maybe a weird question, but I have a report dashboard application, where a specific report contains a lot of records in the database. In general users only check the last 3 reports frequently, so I was wondering if there is an option to convert older reports to a static web page. This way these old reports can be served as static web pages and I don't need to store all those records in the database anymore. Any suggestions how to do this are welcome!

Regards,
John

Thanks, that's something I can work with.

Interesting, but what if I want to keep my own multi-tenancy with account_id's in place, because I don't want to implement a gem. Is there a way for instance in the application controller, where you can set the db settings and change the db connection based on the logged in user?

I have a multi-tenancy app where everything is stored in 1 Postgres database. All models have a account_id, so the data a customer can see is based on his account_id. This works perfect, but due to security and privacy concerns, customers demand that their data is stored in a separate database. So what do I need to do to make this happen? When a custome logs in, then you connect to its own database? And what is the best way to migrate the current data to the several customer databases?

Regards,
John

Posted in Best way to render a page as a PDF

I've been using Wicked PDF quite a lot in our business applications. The good thing is that you can just use HTML and CSS to generate the PDF and this works perfect to create our invoices. But if you really need pixel perfect PDF's then Prawn is the way to go.

Hi Chris,

Attaching the PDF in the email is a great idea, thanks!
Then there is no need for both ActionCable and ActiveStorage, just a message that the email with PDF will be delivered later.

Users can create a PDF in my app which takes some time to generate, so it has to be done in a background job. No problem, but then there is a delay and the user must be notified that the PDF is ready.

So the first choice to make is to either send them an email with a download link or a push notification in the app itself. My preference is the push notification, so I guess ActionCable is the way to go? My app runs on Heroku, so is ActionCable also a good choice then or is another solution preferable?

Then there is another consideration, where to store the generated PDF until the user downloads it? I could upload it to Azure/S3/etc with ActiveStorage, or I could store it temporarily in an app folder and delete it after download. My preference is to do the last, because the PDF is there only for a few minutes and therefore the hassle to store it in the cloud is not really needed?