Simply put, destructuring in Clojure is a way extract values from a datastructure and bind them to symbols, without having to explicitly traverse the datstructure. It allows for elegant and concise Clojure code.
/* | |
* The MIT License (MIT) | |
* | |
* Copyright (c) 2014 Matthieu Harlé | |
* | |
* Permission is hereby granted, free of charge, to any person obtaining a copy | |
* of this software and associated documentation files (the "Software"), to deal | |
* in the Software without restriction, including without limitation the rights | |
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | |
* copies of the Software, and to permit persons to whom the Software is |
After updating pg_hba.conf or postgresql.conf, the server needs the config needs to be reloaded. The easiest way to do this is by restarting the postgres service:
service postgresql restart
When the service
command is not available (no upstart on Synology NAS, for example), there are some more creative ways to reload the config. Note this first one needs to be done under the user that runs postgres (usually the user=postgres
).
user# sudo su postgres
postgres# pg_ctl reload
Cheat Sheets are greate but they are not a substitute for learning the framework and reading the documentation as we most certainly have not covered every potential example here. Please refer to the Rails Command Line Docs for more information.
You can get all of this information on the command line.
rails generate
with no generator name will output a list of all available generators and some information about global options.
rails generate GENERATOR --help
will list the options that can be passed to the specified generator.
If you boil it all down, here's the basic flow through the app (with some gotcha's)
When there is a request for a page in a Rails-only app, the controller handles and routes the request, and renders a View. When the DOM is being written, some special Stimulus tags cue the instantiation of an associated Stimulus controller. The DOM also listens for user actions that are attached to some page elements via some other special Stimulus tags. When an event occurs, the associated function is called and runs its code to update the DOM without reloading the page.
So... what are the special tags? Here's a longer breakdown:
- A section of html is wrapped in a div with a
data-controller
tag. (The section that is wrapped should contain all the page elements that you plan to listen to or act upon using that controller). The value corresponds to the name of a StimulusJS controller: