by csande17 · 5y ago · 0 comments
Original:
> Mailers are really just another way to render a view.
"Edited":
> Mailers are another way to render a view.
The original sentence suggests that, while mailers may look different, they use the same underlying "render a view" mechanism (as some other part of Rails, presumably). The revised version makes it sound like if I wanted to render a view, I could choose to use either a mailer or some other system to accomplish that task. Like, "hmm, I really want to render this view, should I use a templating system or a mailer?"
Nevertheless, as the author said, I do find removing the superfluous "just" after the first sentence is warranted. The original text used 3 "just". One "just" in the first sentence is enough. And definitely don't write "painfully simple".
---
On second thought, if this is what you want to express by using a "just", a better idea is to say it explicitly, let me try...
> Mailers is yet another option to render a view. similar to the HTTP module. Instead of rendering a view and sending it over the HTTP protocol, they send it out through email protocols instead.
This can be the better alternative of both versions. Be straightforward, don't use subtle language in a technical document.
I learn best by analogy, so the first version in the article was very helpful and comforting. The second version makes me, and I think the parent and grandparent, expect that view rendering is more like requisite knowledge than a possibly useful analogy. "Only true experts in how views are rendered need apply, I better study that first."
Original:
> Mailers are really just another way to render a view.
"Edited":
> Mailers are another way to render a view.
My Edit:
> Mailers are another way to render a view, much like the linkTo(RenderMethod()).
It needs clear wording, perhaps like "this is a wrapper around" or "this is an alternative to" or "this is one of the" followed by more detail.
Software documentation should be more like scientific article writing: passive, and having few or no modifiers like “trivial” or “just” or the like.
I regularly call out engineers when they say "just", in a lot of cases when I say - can you explain "just" they go and pull out their collection of familiarity and understanding. To which I usually ask - "How much of your understanding will the reader have?".
When I ask them to remove the just, suddenly a single word becomes a couple of sentences that expand the "just". Magically something trivialized becomes described.
"Mailer is one of muliple ways to render a view. It translates a view into a text- or HTML-Email.
Other available Renderers are PDFWriter, Printer and CSVWriter"
https://guides.rubyonrails.org/v4.2.0/action_mailer_basics.h...
Looking at this documentation in context, the point it's attempting to make here is that since mailers are rendering a view, the appropriate place to call them is from the controller (as opposed to the model, I suppose). The documentation has already repeatedly made the point that mailers are like controllers, that they render views, etc.:
> Mailers are very similar to Rails controllers. They also have methods called "actions" and use views to structure the content. Where a controller generates content like HTML to send back to the client, a Mailer creates a message to be delivered via email.
So I would argue that both the OP's suggested change and a lot of the ones in this thread aren't quite right. The reader has already been told that mailers render views. The "corrected" version misses this and tosses out the main point while preserving the repetitive throat-clearing. Within the context of a step-by-step guide, meant to be read in order, a better clarification might be something like this:
> Since Mailers are another way to render a view, it makes sense to call them from the controller. In our example, we will call the UserMailer at the time a user is successfully created.
(Whether this is actually good advice is a separate question.)
Perhaps a more effective edit would just use controllers as an analogy from the beginning instead of focusing on views.
> Mailers are like controllers, but for email instead of HTTP.
Edited that for you.