...no longer recommend this option. After a chrome update, the chromedriver package sometimes lags behind and is not compatible. Install via apt install chromium-chromedriver Option 3: Install via npm...
...no longer recommend this option. After a chrome update, the chromedriver package sometimes lags behind and is not compatible. There's a handy npm package. sudo npm -g install chromedriver...
has_many :images, through: :album_images end # Join model class AlbumImage < ActiveRecord::Base belongs_to :album belongs_to :image end Destroying a record in this setup will only remove...
...the record itself, and leave orphaned join records behind. image = Image.last image.destroy # removes only the `image` record, # but none of the associated `album_image` join records Good
Note netstat has mostly been superseeded by its more modern rewrite ss which nowadays comes pre-installed rather than netstat...
Rails partials have a lot of "hidden" features and this card describes some non-obvious usages of Rails Partials.
There are several tools for DNS debugging which offer you more or less information. Most of the time the more...
This is a small example on how you can check if your Postgres index can be used by a specific...
Why do we migrate? Due to a change in licensing, we cannot provide Elasticsearch versions >= 8.0. Version 7.17.x will...
...instead of using a more costing feature spec. This is especially useful because they become quite convenient when used with Capybara::Node::Finders and Capybara::RSpecMatchers. This allows to wirte...
...view might be too isolated, since view-specs will mock a lot of rails behavior and render the view independent from the controller-logic. Therefore it will be more applicable...
The recommended additional setup of the spreewald gem, a useful set of cucumber steps, includes adding a file for defining...
If you're responsible for gatekeeping in a projects, here is a guide, what to do. In order to reduce...
Sometimes you need to remove high Unicode characters from a string, so all characters have a code point between 0...
Download buttons can be difficult to test, especially with Selenium. Depending on browser, user settings and response headers, one of...
When selecting records in a date range, take care not to do it like this: start_date = Date.parse('2007-05...
It might sometimes be useful to check whether your Rails application accesses the file system unnecessarily, for example if your...
While it might be tempting to set it per project (other devs might benefit from it), you need to do it each time for every project "pollute" a project...
You can convert git commits into patch files. Those can be used to apply to a different repository [1] or...
This still relies on params[:id] existing, so your code should reflect that: # Better User.find(params.expect(:id)) # Or User.find(params.require(:id)) Avoiding issues with extra parameters Rails logs extra...
...should still use permit (or expect) to receive Strong Parameters, but strip extra parameters. # Better (option 1) redirect_to users_path(params.slice(:query, :encoding).permit(:query, :encoding)) # Better (option...
When a user shares your content, a snippet with title, image, link and description appears in her timeline. By default...
When you want to group rails models of a logical context, namespaces are your friend. However, if you have a...
To retrieve only unique combinations of the selected attributes: You can omit rows, where all selected columns are equal with...
...rendering quality is now fine in recent versions of wkhtmltopdf (0.12+). You will never beat LaTeX if you need perfect font rendering. If you are observing strange behavior when including...
...might experience that your application "locks up" whenever you request a .pdf route. This behavior is caused by a deadlock: The Rails process is trying to render the page to...
ActiveSupport (since 4.1) includes test helpers to manipulate time, just like the Timecop gem: To freeze the current time, use...
You cannot use Array#join on an array of strings where some strings are html_safe and others are not...
...won't need this for single lines of text. In this case it is better to just use the text-overflow property: Use CSS "text-overflow" to truncate long texts...
...starts wrapping within its container. This is most probably because there is no defined behavior in case multiple text contents are rendered next to each other (horizontally) and the clamping...