...need to pay attention if you redirect outside of Rails, e.g. via your web server configuration. Dealing with incorrectly cached redirects The only fix is to keep redirecting the user...
...the MariaDB monitor. Commands end with ; or \g. Your MySQL connection id is 2 Server version: 5.7.35 MySQL Community Server (GPL) Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and...
...response in form round trips, since the id can not be assigned by the server while it may be outputting Unpermitted parameter: :id within the console. You are not setting...
When you need test images, instead of using services like lorempixel or placehold.it you may generate test images yourself. Here we build a simple SVG image and wrap it into...
...attached JSFiddle for an example. Ruby If you like to do it on the server, here is some Ruby for you: def svg_uri(text) svg = <<~SVG #{text} SVG
Values in the JavaScript API or when submitting forms to the server will always use a point as decimal separator (i.e. "1.23" even when the browser displays...
...a validation a malicious user can quickly exhaust the hard drive of your database server. In legacy Rails (or database schemas migrated from legacy Rails), database types :string and :text...
Getting an entire test suite green can be a tedious task which involves frequent switches between the CLI that is...
...To do that you need the secret key which should only live on the servers. Do not download these key files to your local dev environment. They are sensitive and...
...an exception has no mapping, Rails will assume a status code of 500 (internal server error) and will render a red "We're sorry, but something went wrong"
...hardcoded asset hosts in webpack, otherwise all chunks would be loaded through the # Capybara server of the first test process. If that test process hasn't launched a Capybara
...Webpacker.compile That's it. Enjoy! 🎉 Similar scenario: running an application with Webpacker on multiple servers. How to serve identical assets from all servers...
...on all of them. 3) Switch to a persisted storage for sessions on the server Another option to prevent this session replay attack is to switch to persisted storage for...
up.util.isEqual([1, 2], [1, 2]) // => true If you are writing server-side code in Node.js you can use isDeepStrictEqual(): import { isDeepStrictEqual } from 'util' isDeepStrictEqual([1, 2], [2, 3]) // => false...
...sender address of the application's domain, our operations team will have configured your servers and DNS records to cover the most obvious cases (SPF records, reverse DNS lookup, etc...
...pages, so to test it in development, you will have to start your development server with SSL...
...seen cases in production where such queries consume GBs of memory bringing down our servers. The solution Just use .preload instead. Rails will use separate queries to preload the data...
Note that we prefer not using the Rails asset pipeline at all and serving all assets through Webpack for the sake of consistency. Preparations Remove version locks in Gemfile...
Remove version locks in package.json for webpack and webpack-dev-server Install by calling bundle update webpacker and yarn upgrade Update file contents Work through the Webpacker...
...Uses a filename from the response URL if no filename is sent by the server. Does not leave the current page when downloading. Works with both static files and send...
Fails the test if the server doesn't respond with a HTTP 2xx status. Works in CI. Limitations The helper cannot inspect downloads that are triggered or created by...
...which hold time zone information and Time.now only in those that run with the server's time. If you don't, bad things can and will happen. More information can...
...more and more memory and prevent the garbage collector from reclaiming memory. This userRepository service caches users once they were loaded from a remote server and, hence, leaks memory:
...argument that will be the result of that block iteration. The following method will serve as an example in the details below: def example puts yield puts 'done' return 'example...
We use the whenever gem to automatically update the crontab of the servers we deploy to. By default, whenever will update all servers with a matching role (we use the...
...be evaluated when running middleman for the specific environment. Default for the local dev server is development, default for building is production. Activate an environment with -e staging or --environment...
...be "built", too. However, testing in :build mode oddly # takes thrice as long as :server: mode, so you might try and skip this # setting for faster test runs. config[:mode...
OpenSSL::SSL::SSLError: SSL_connect returned=1 errno=0 state=SSLv3 read server certificate B: certificate verify failed Here is how to fix that in your application.
...This is only okay-ish for testing something in development. Note that there are services like badssl.com to test against weird SSL behavior. Self-signed certificates Talking to a host...
...alternative to net/http and shares many concepts with WebMock. You can fake a remote server response like this: stub_request(:get, 'http://host/api').to_return(:body => 'fake body')