Ubuntu 18.04 uses systemd to manage services. There are basically two commands for listing all services and manipulating the state...
In the following example the method update_offices_people_count won't be called when office_id changes, because it...
...like keeping some HTML. If you only care about line breaks, you might be better off using a small, specialized helper method: def format_linebreaks(text) safe_text = h(text...
When using virtual attributes, the attached trait can be useful to automatically copy errors from one attribute to another.
In the Gitlab settings the flag Auto-cancel redundant pipelines is enabled by default. This auto-cancels jobs that have...
...the joins, and then authors for the pluck clause. The first corresponds to the belongs_to relationship, and the latter is the name of the db table. You could even...
First find the reference for the entry you want through looking at the stash: $ git stash list stash@{0}: WIP...
...you can use a special form options helper called #collection_check_boxes. It behaves similar to #collection_select, but instead of a single select field it renders a checkbox and...
Ruby lets you re-use existing RegExp objects by interpolating it into new patterns: locales_pattern = /de|en|fr|es/i...
Sometimes you might need to nest a git-project inside another git-project. The right strategy is to use submodules...
We use the whenever gem to automatically update the crontab of the servers we deploy to. By default, whenever will...
around do |example| superuser_power = Power.new(create(:user, :superuser)) Power.with_power(superuser_power) do # before-block will be run here, DB snapshot will be created example.run # after-block will...
Chrome has a built-in utility to check performance and accessibility (and more) of your web app: Lighthouse.
...Powerless but nothing was raised No power to ['creatable_cards'] The reason for this behavior is that the Capybara test server is running in another thread, and the RSpec thread...
You can define methods in any example group using Ruby's def keyword or define_method method: describe "example" do...
...line-height is font-size relative, but the problem is that font-size: 100px behaves differently across font-families, so is line-height always the same or different? Is it...
In esbuild, you usually import other files using relative paths: import './some-related-module' import `../../utils/some-utility-module` import `../../../css/some-css.sass` This is totally fine...
Capybara has a variety of finder methods like find_button to help you look up DOM elements. There are also...
You can use git worktree to manage multiple working trees attached to the same repository. But why should I use...
...only because your step definition requires that. Here's a typical step definitions that benefits from using find_by_anything: When /^I sign in as "([^\"]+)")$/ do |identifier| user = User.find_by...
We often have a separate production branch that lags a bit behind the more cutting edge main branch. Sometimes you want to move some, but not all commits from main...
When storing floating-point numbers such as prices or totals in an SQL database, always use a DECIMAL column. Never...
Using git fixup helps you to speed up appending changes further back in the git history of your feature branch...
...the resulting record will not have the attributes that defined that scope, and this behavior can be quite useful. Because you cannot have the best from both worlds you should...
...article and make informed choices about how to define your conditions. Also see the Best Practice section below. The problem in detail Consider this Rails class and the following articles...