1
0
mirror of https://github.com/jbranchaud/til synced 2026-01-08 17:48:01 +00:00

Compare commits

...

3 Commits

Author SHA1 Message Date
nick-w-nick
d46aa6510e Merge 295fe153ad into 4ff24a7336 2025-03-03 11:50:19 -05:00
jbranchaud
4ff24a7336 Add Restart Puma Server By Touching Restart File as a Rails TIL 2025-03-01 09:48:48 -06:00
nick-w-nick
295fe153ad added mention of ES6 compatibility
Hello, I've added a small blockquote below the description to indicate that this method of accessing an indefinite number of function arguments has been superseded by the use of the spread operator via rest parameters for ES6+ compatibility.
2022-01-06 11:39:04 -05:00
3 changed files with 32 additions and 1 deletions

View File

@@ -10,7 +10,7 @@ pairing with smart people at Hashrocket.
For a steady stream of TILs, [sign up for my newsletter](https://crafty-builder-6996.ck.page/e169c61186).
_1603 TILs and counting..._
_1604 TILs and counting..._
See some of the other learning resources I work on:
- [Ruby Operator Lookup](https://www.visualmode.dev/ruby-operators)
@@ -1074,6 +1074,7 @@ If you've learned something here, support my efforts writing daily TILs by
- [Rescue From](rails/rescue-from.md)
- [Rescue From With A Separate Method](rails/rescue-from-with-a-separate-method.md)
- [Respond With JSON Regardless of Content Type](rails/respond-with-json-regardless-of-content-type.md)
- [Restart Puma Server By Touching Restart File](rails/restart-puma-server-by-touching-restart-file.md)
- [Retrieve An Object If It Exists](rails/retrieve-an-object-if-it-exists.md)
- [Rollback A Couple Migrations](rails/rollback-a-couple-migrations.md)
- [Rollback A Specific Migration Out Of Order](rails/rollback-a-specific-migration-out-of-order.md)

View File

@@ -5,6 +5,8 @@ an array-like object with all of the arguments to the function. Even if not
all of the arguments are referenced in the function signature, they can
still be accessed via the `arguments` object.
> For ES6+ compatibility, the `spread` operator used via [rest parameters](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions/rest_parameters) is preferred over the `arugments` object when accessing an abritrary number of function arguments.
```javascript
function argTest(one) {
console.log(one);

View File

@@ -0,0 +1,28 @@
# Restart Puma Server By Touching Restart File
Puma includes a plugin that allows us to restart the web server by touching the
`tmp/restart.txt` file.
In one terminal pane I have my Rails server running. In another terminal pane
from the Rails directory, where there exists a `tmp` folder, I run the
following command.
```bash
$ touch tmp/restart.txt
```
Then in the pane running the Rails server, I see the following after a second:
```
* Restarting...
=> Booting Puma
=> Rails 8.0.1 application starting in development
...
```
What is happening is that `touch` updates the modified time of that file, which
already exists in the `temp` directory. When the plugin notices (it checks
every 2 seconds) that the modified time is now fresher than the original
modified time when the plugin started, then it calls `launcher.restart`.
[source](https://github.com/puma/puma/blob/ca201ef69757f8830b636251b0af7a51270eb68a/lib/puma/plugin/tmp_restart.rb)