As a developer you may have many tools watching your project for changes: Your IDE, Webpack, Guard, etc. This is...

Jasmine specs for the frontend often need some DOM elements to work with. Because creating them is such a common...

This can happen with a very simple model: class Note has_many :attachments end Everything looks normal: Note.all.to_a.size # => 8 Note.all.ids.size...

github.com

ActiveType::Object inherits from ActiveRecod::Base and is designed to behave like an ActiveRecord Object, just without the database...

Unpoly's [up-observe], [up-autosubmit] and [up-validate] as well as their programmatic variants up.observe() and up.autosubmit...

To allow HTTP 304 responses, Rails offers the fresh_when method for controllers. The most common way is to pass...

greg.molnar.io

Greg Molnar has written a neat article about creating a single-file Rails app. This is not meant for production...

When your Rails application offers downloading a bunch of files as ZIP archive, you basically have two options:

paweldabrowski.com

The linked content includes a few design patterns implemented with Ruby on Rails. What is the card indented to achieve...

This should be fixed in the latest LTS-branches of our mysql2 fork, 0.2.x-lts and 0.3.x-lts...

SELECT pg_size_pretty(pg_database_size('some-database')); Example SELECT pg_size_pretty(pg_database_size('cards_p')); ----------------

Ruby includes many standard gems that are bundled into the Ruby installation. Here is an example for the gem strscan...

When paginating records, we usually need to know the number of total records in order to render pagination links. Popular...

You can use the code below to check whether the browser can make connections to the current site: await isOnline...

joshmcarthur.com

I recently wanted to add a model for address information but also wanted to add a unique index to those...

blog.saeloun.com

Imagine these models and associations: class Deck < ApplicationRecord has_many :cards end class Card < ApplicationRecord belongs_to :deck, optional: true...

It might sometimes be useful to check whether your Rails application accesses the file system unnecessarily, for example if your...

tl;dr With ES2021 you now can use str.replaceAll(), Promise.any(), logical assignment operators, numeric separators and WeakRef on all major...

There is a way to use multiple databases in Rails. You may have asked yourself how you're able to...

tl;dr You can use attribute? as shorthanded version of attribute.present?, except for numeric attributes and associations. Technical Details

You can use Unpoly's up.on with a named listener function and immediately unbind this event listener with { once: true...

tl;dr: Use the URLSearchParams API to make your live easier if you want to get or manipulate query parameters...

This card explains how to generate an entity relationship diagram for your Rails application. We also show how to limit...

RSpec's let allows you to super into "outside" definitions, in parent contexts. Example: describe '#save' do subject { described_class.new(attributes...