...must only differ in their conditions (#where, #having). If either side has a #join, #includes, etc., it will throw an error: authorized_users.and(filtered_users.join(:account)).to_sql # => ArgumentError: Relation passed to...
@cards = Card .where(...) .preload(:user, :deck) .to_a end end You can include strict_loading somewhere in the scope chain: class CardsController < ApplicationController def index @cards = Card
...Vacation.create(period: 2.weeks.ago..1.day.ago) Note In Ruby 1...10 excludes 10 and 1..10 includes 10. Ruby also supports 1.. and ..1 as endless ranges. Syntax [,]::daterange or (,)::daterange...
...contains all days [2025-12-12, 2026-12-12)::daterange // 12.12.2025 until but not including 12.12.2026 [2025-12-12, 2026-12-12]::daterange // 12.12.2025 until 12.12.2026 [2025-12-12, ]::daterange...
...const textReplace = require('esbuild-plugin-text-replace') const esbuild = require('esbuild') esbuild.build({ ... plugins: [ textReplace({ include: /jasmine-core\/lib\/jasmine-core\/jasmine\.js$/, pattern: [ ['let jasmineRequire;', 'let jasmineRequire; const global = window;'], // Make Jasmine...
ruby-warning adds custom processing for warnings, including the ability to ignore specific warning messages, ignore warnings in specific files/directories, include backtraces with warnings, treat warnings as errors, deduplicate warnings...
...of all commands in the byebug guide The linked cheatsheet at the bottom also includes some examples and all the aliases to every command with a different useful structuring of...
...access to some path methods generated by your routes. Even though you could technically include Rails.application.routes.url_helpers, this may include way too many methods and even overwrite some class methods...
When changing the glibc version, it's possible that the upgrade also includes changes to how locales work. This is especially relevant when using PostgreSQL databases (of any version), since...
...Ubuntu LTS version 20.04 ships with 2.31. Upgrading operating systems between those versions will include this change in locales. If there has not been any upgrade to the OS hosting...
...took from the start until the file transfer was just about to begin. This includes all pre-transfer commands and negotiations that are specific to the particular protocol(s) involved...
...time_redirect The time, in seconds, it took for all redirection steps including name lookup, connect, pretransfer and transfer before the final transaction was started. time_redirect shows the complete...
...an escape sequence like this: echo -en "\033]0;Hello\a" You can easily include the current path: echo -en "\033]0;$(pwd)\a" Or, to replace your home directory...
...return withAuthorizedUser(async ({ accessibleBy }) => { const prisma = await prismaClient() const comment = await prisma.comment.findUnique({ where: { uuid }, include: { file: true }, }) if (!comment) { return notFound() } await prisma.comment.delete({ where: { uuid, AND: accessibleBy('delete').Comment, }, }) revalidatePath...
...Product owner (PO): with the customer Developer Development Take responsibility for their stories. This includes always gathering all necessary information from the project lead or the PM, communicate blockers, make...
...engineering with the customer Create stories with the project lead Communicate with the customer, including tunneling questions of developers (or have them talk to the customer directly, if required)
...new gem named memoized. memoized is API-compatible to memoizer, you just need to include Memoized instead of Memoizer: class A include Memoized memoize def hello 'hello!' end
In ruby you can easily read and write CSVs with the standard CSV library class. On top of this, you...
...called by super within the current object #comment: The comment of the method (often includes a short discription) #source: The actual code of the method #source_location: The file path...
...database-specific tool like pg_dump, you can now serialize every single schema property, including proprietary features. Unfortunately using structure.sql comes with some disadvantages. Why structure.sql can churn wildly
...lot of noise and merge conflicts in your repository. Possible reasons for this churn include: Two developers use different versions of the database server (e.g. PostgreSQL 16 vs. 17).
...in your stylesheets. Usually this should not be a problem, but at times they include misleading Meta-information that leads to a strange error in the PDF. The setup
...Corresponding Rails Guide Controller generators Rails ships with a ResourceHelpers module. Require 'rails/generators/active_model' and include Rails::Generators::ResourceHelpers inside your generator class to have some helpers at hand, i.e. controller...
...TypeScript, and modern browsers will run them natively. Features supported by all modern browsers include: fat arrow functions (() => { expr }) let / const class async / await Promises Generators Symbols Rest arguments (...args...
...functionality to a a new controller, not the movies controller. The movie/actor association should include an attribute for the name of the played character You only need very basic styling...
Modern JavaScript includes Intl.NumberFormat to format numbers in different formats and locales. In this card, we describe a wrapper for it that humanizes a given number of seconds in the...
...the file structure on disc. A general approach Part A: Create a commit which includes a script that allows you to copy the existing file to the new file structure...
Undoing a broken text is very hard or impossible. The text can include any type of file link (e.g. link to profile image) and not only image links...
...Use a test harness A test harness is a Ruby module that you include in the Cucumber world. This way the module's methods become available to all step definitions...
...bar' # same thing h['foo'] # => 'bar' h.foo # => 'bar' in? (> 3.0 only) reverse of Array#include? characters = ["Konata", "Kagami", "Tsukasa"] "Konata".in?(characters) # => true Array.wrap wraps argument in an array, unless...