CarrierWave comes with a set of default configuration options which make sense in most cases. However, you should review these...
ActiveSupport (since 4.1) includes test helpers to manipulate time, just like the Timecop gem: To freeze the current time, use...
If you're responsible for gatekeeping in a projects, here is a guide, what to do. In order to reduce...
...requestAnimationFrame can be used to reduce the number of repaints for animations. This might benefit your application performance. Read Don't throw exceptions from async functions What Color Is Your...
...helperFunction? What happens when you remove the await of init? What causes the new behavior? Now have a look at this sketched usage of asynchronous functions: const news = await fetchNews...
When selecting records in a date range, take care not to do it like this: start_date = Date.parse('2007-05...
...a feature look and feel). Frequent deploy gets changes to users faster. We sleep better, because we know stuff still works. Make sure no one removes a feature by accident...
...application changes. The more tests you already have, the less useful an additional test becomes ("Diminishing returns"). Tests sometimes fail even though the code is fine, especially when the test...
It might sometimes be useful to check whether your Rails application accesses the file system unnecessarily, for example if your...
Below is a strict, but still workable Content Security Policy for your Ruby on Rails project. Use this CSP if...
Ever needed to migrate data between Redis instances? Give RIOT - Redis Input/Output Tools a try. It supports migration to different...
You can convert git commits into patch files. Those can be used to apply to a different repository [1] or...
Download buttons can be difficult to test, especially with Selenium. Depending on browser, user settings and response headers, one of...
Resources Rails Guide: Internationalization API Guide to localizing a Rails application Locale-aware helpers in ActionView::Helpers::NumberHelper
...never influence each other On a similar note, we don't want tests to behave differently based on their execution order or parallelism. One core mechanism in this regard is...
...give your Movie model a #person attribute. Instead, use FactoryBot's transient attributes and before/after hooks to implement the factory above...
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...
For webpages to load fast it's recommended to optimize images. Ideally an image's file size should be as...
Developing or debugging SAML functionality can be a hassle, especially when you need to go back and forth with someone...
...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...
You cannot use Array#join on an array of strings where some strings are html_safe and others are not...
def self.acquire(name) already_acquired = definitely_acquired?(name) if already_acquired yield else begin create(:name => name) unless find_by_name(name) rescue ActiveRecord::StatementInvalid # concurrent create is okay...
begin result = nil transaction do find_by_name(name, :lock => true) # this is the call that will block acquired_lock(name) result = yield end result ensure maybe_released_lock...
Due to the way we setup Jasmine tests in our projects, you may run into various errors when Jasmine boots...
Rails default config uses the ActiveSupport::Cache::NullStore and disables controller caching for all environments except production: config.action_controller.perform_caching = false...
Why secure-only cookies used to be necessary Cookies have an optional secure flag. It tells the browser to not...
Full-text search can reach its limits in terms of flexibility and performance. In such cases, trigram indexes (pg_trgm...