Ubuntu has a package mysql-sandbox that lets you install multiple MySQL versions into your user home: Install mysql-sandbox...
...reject_if: :all_blank # Ignore the blank template record end class Image < ActiveRecord::Base belongs_to :gallery mount_uploader :teh_image, YourUploaderHere # Mount Carrierwave on attribute :teh_image end
...to automatically fix the whitespace, see below. (Note that this might lead to unexpected behaviour e.g. in Markdown documents.) The global git hooks live in $PREFIX/share/git-core/templates/hooks (where $PREFIX is probably...
Debouncing a method call delays its execution until after a specified time has passed. If it's called again before...
...of time, but it will always be retried at least a second time. This behavior allows with_scope to be patient, and it must be patient, as explained below.
Rails 6.1 has a "strict loading" mode that forces the developer to preload any association they plan to use. Associations...
This decision tree describes how to use the alt attribute of the element in various situations. For some types of...
The tree command will show you the contents of a directory and all its sub directories as a tree:
Rails has the handy controller method send_file which lets us download files easily. We can decide whether the file...
...is no longer established using sudo per default. Databases created for local development usually belong to the local user an therefore do not need to be accessed using sudo...
...Use the attached Modularity below to add such a magical array to your model. Besides using the trait, you will need to implement two methods to synchronize the string array...
For my Gem Session project Holly I ran the Ironman of drag'n'drop implementations: Dragging in nested lists
When your Rails application is using Redis as its cache store, this is how you can list existing keys:
Note: Making a reverse proxy with nginx is much more straightforward. A reverse proxy is a "man in the middle...
...its mount path. It starts with /media/. Open a terminal and sudo su to become root. We require root for everything. Use dd to create an image of your encrypted...
...which point the exception was thrown. def self.search_solr_with_exception_handling(*types, &block) begin search_solr_without_exception_handling(*types, &block) rescue Errno::ECONNREFUSED, Timeout::Error => e message = "Verbindung...
Ruby methods which load from a Yaml file, like YAML.safe_load or YAML.safe_load_file, support passing freeze: true to...
Sometimes you might need to do some task in GitLab which would be tedious if you'd have to do...
A severe bug was found in ImageMagick by Bryan Gonzalez from Ocelot Team. It allows to embed the content of...
...Chrome for Testing if none is found on the system. I worked around this behavior by setting the path to the binary in the selenium initializer Capybara.register_driver :selenium do...
...spawns another process to run a browser, it will inherit the environment and also believe it lives in that zone. To do so, run the following code before your test...
Use option:checked to find the currently selected option: select.querySelector('option:checked') Yes, :checked, not :selected. This is the same...
With this command you can run all the spec files which have been edited or added in the current branch...
When receiving a new SSL-Certificate for an existing SSL-key it should be checked that they match cryptographically.