Creează un cont pentru a te abona la acest blog și a-i urmări articolele pe pagina Lectură.
-
Sometimes just using preload or includes is not possible… or maybe it is, but you just can’t figure it out how to do it.
-
Maybe you are already familiar with includes or preload, but you know that a lot of the time you will need more than just preload(:comments).
-
An n+1 queries problem means that a query is executed for every result of a previous query.
-
A common cause of n+1 queries is fetching the “latest-N-of-each” record on a list of records.
-
There are different practices, that I know, to test that an email was sent in Rails… Check for the ActionMailer::Base.deliveries Spy your own sender objects Use doubles for your mailer objects All of them have pros and cons and will help you test different
-
If you want to test that an email was sent on a system spec in rails… What you can do is to check the ActionMailer::Base.deliveries to see if the email that you want is there.
-
As you may now there are two hard things in computer science and one of them is naming things.
-
I like heroku, it is very easy to use, but sometimes you just can’t use it… Maybe it is too expensive for your project.
-
Maybe your are thinking that you should just use Heroku and move on with your life.
-
For most of us, heroku is a really useful tool because it does so much for us, but in some cases it could look like it is really expensive… … Is it really expensive?
-
Imagine that you need to query for the payments received the “week before” of a given date.
-
Imagine that you need to query for the records created in the “week before” of a given date.
-
This was new for me, I was looking how to get the noCertificado from a CSD (Certificado de Sello Digital) and I found it is the serial of the certificate but in base 2.
-
Do you want to test a PDF download with capybara, but don’t know how to do it?
-
Do you need/want to test a CSV download with capybara, but don’t know how to do it?
-
A code sample of a “read-more” behavior using the rails truncate method and Stimulus.js.
-
I have already shared a way of implementing a “read-more” behavior truncating by the number of lines instead of the number of words.
-
Are you looking for a way of implementing a “read-more” behavior truncating by the number of lines instead of the number of words?
-
Are you working with capybara?
-
Imagine that you want to refactor this… expect(row).to have_css("[data-role=description]", text: "Desc 1") expect(row).to have_css("[data-role=amount]", text: "$250.00") into this… expect(row).to display_entry_with("Desc1", $250.00) What would you do?
-
There are many tools that can help you detect n+1 queries in different ways.
-
Do you need more practice to understand the difference between “includes”, “preload”, “eager_load” and “joins”?
-
I am currently working on a kind of “presentation object” that I called IdealPayments::GlobalStats.
-
Do you know “in theory” the difference between “includes”, “preload”, “eager_load” and “joins”, but you still think that you need more examples to really understand how to use them?
-
Do you know “in theory” the difference between “includes”, “preload”, “eager_load” and “joins”, but you still think that you need more examples to really understand how to use them?
-
Are you using Active Storage to handle file uploading to the cloud (maybe AWS) and you want to know how to attach an uploaded file to an email?
-
Even if you already know what is the difference between includes, preload and eager_load, maybe is not that clear when is better for you to use one vs the other.
-
Are you dealing with includes, preload, eager_load and joins, maybe fixing some n+1 queries, but you are not really sure what’s the difference between all of them?
-
A common cause of n+1 queries is fetching the “latest-N-of-each” record on a list of records.
-
Do you struggle fixing N+1 queries because is hard for you to detect why ActiveRecord seems to ignore your “includes”?
-
Do you have a method that works fine with a single record, but when you use it on a list causes N+1 queries?
-
When you are trying to solve an n+1 problem, hopefully you will find different ways to solve it.
-
What fix should you pick for your “latest-comment” n+1 queries problem?
-
Do you have to fetch the latest “x” of each record?
-
Do you have to fetch the latest “x” of each record?
-
What fix should you pick for your n+1 queries problem?
-
Do you have a method that works fine with a single record, but when you use it on a list causes N+1 queries?
-
Have you been stuck trying to build a form to save more than one record?
-
Have you ever implemented a feature that does work, but has resulted in using multiple conditionals in your controller and views… Wondering if there is a better way to do what you just did?
-
Do you have a method that works fine with a single record, but when you use it on a list causes N+1 queries?