Partials always define a local variable with the same name as themselves. E.g. when you are in _recent_users.html.erb, a local...
When a method has keyword arguments, Ruby offers implicit conversion of a Hash argument into keyword arguments. This conversion is...
Zeitwerk is the new autoloader of Rails. It is mandatory starting with Rails 7.0. Sometimes, a model needs to know...
Controllers Take care when defining nested resources, as they don't behave identical to namespaced resources: namespace :users do resources :sign_ups, only: [:new] end # GET /users/sign_ups/new...
...in controllers/sign_ups_controller.rb in order to make the second example work. You can alter this behaviour with a custom controller path, as shown in the very first example of this card...
...to work as expected Good Then the crontab -l output will look like this: # Begin Whenever generated tasks for: some-app_staging 34 23 * * * /bin/bash -l -c 'cd /var/www/some-app_staging/releases/20201215171150 && RAILS...
...value, that can not be replaced by Whenever (the release folder changes every deploy): # Begin Whenever generated tasks for: /var/www/some-app_staging/releases/20201215171150 34 23 * * * /bin/bash -l -c 'cd /var/www/some-app_staging/releases/20201215171150 && RAILS_ENV=staging...
...applications with forms (warp_params will do that for you). But maybe its a better idea to stick to a standard that client libraries know to handle. Tests
...really nice and we implemented it in a similar way like here. In the beginning we tried to remove any duplicated in the schema files. So when a booking had...
...also packaged as a snap. A snap will always track a channel (like stable, beta) and automatically update to the newest version available in this channel. By default the snap...
channels: stable: 2018.3.2 (72) 269MB classic candidate: 2018.3.2 (72) 269MB classic beta: 2018.3.2 (72) 269MB classic edge: 2018.3.2 (72) 269MB classic 2018.3/stable: 2018.3.2 (72) 269MB classic 2018.3/candidate...
If you want to see how long your database queries actually take, you need to disable MySQL's query cache...
=> >> response.code => 422 FYI, the http gem is a great alternative to RestClient which behaves like that by default and has a well-designed API in general (much better than...
In case you want to use pry with an older version of Ruby, you can try the following configurations.
Imagine you want to write a cucumber test for a user-to-user chat. To do this, you need the...
...its version number, it is considered a pre-release: 1.0.0.rc1 2.3.0.alpha2 3.0.0.beta3 4.0.0.pre.rc2 Even if a pre-release gem has the highest version number, it is...
...Semantic versioning Converted RubyGems version 1.0.0-rc1 1.0.0.pre.rc1 2.3.0-alpha2 2.3.0.pre.alpha2 3.0.0-beta3 3.0.0.pre.beta3 Note that npm packages force you to use Semantic Versioning's naming convention...
Usually you add errors to :base in ActiveRecord, in case no appropriate attribute could be used to add the error...
tl;dr: Avoid to memoize methods with default (keyword) arguments! When you are using Memoized with default arguments or default...
You can tell npm to install a package globally with npm -g install @puppeteer/browsers. However, it seems that its not...
sudo gem install gettext --no-ri --no-rdoc sudo gem install fast_gettext --no-ri --no-rdoc script/plugin install git://...
The sprintf method has a reference by name format option: sprintf("% d : % f", { :foo => 1, :bar => 2 }) # => 1 : 2.000000
Browsers blocks abusable JavaScript API calls until the user has interacted with the document. Examples would be opening new tab...
If your Webpack build is slow, you can use the Speed Measure Plugin for Webpack to figure out where time...
Chromedriver (or selenium-webdriver?) will not reliably scroll elements into view before clicking them, and actually not click the element...
As an application exists, data accumulates. While you'll be loosely monitoring the main models' record count, some supportive database...
If you use a newer SSH key generated with the ED25519 algorithm instead of RSA (see Create a new SSH...
PostgreSQL and ActiveRecord have a good support for storing dynamic attributes (hashes) in columns of type JSONB. But sometimes you...
...calls html_safe if you're not escaping. FWIW, an HTML string may easily become invalid when truncated, e.g. when a closing tag gets chopped off. However, when the input...