When you need to find out in which kind of spec you are during run-time, it's definitely possible...
...GA configurable without changing anything in the application's code base (and much more beyond, see below). Only prefer GTM if the customer requests it, or if he is updating...
...his tracking requirements frequently. The idea behind GTM The "tag" in "Google Tag Manager" has nothing to do with HTML tags, nor with word tags or tag clouds. In the...
Flash movies (.swf files) can talk with Javascript code embedded in the same HTML page. There are two ways to...
Note Using rem only ever makes sense when the root font size is dynamic, i.e. you leave control to the...
Ever needed to use a global variable in Rails? Ugh, that's the worst. If you need global state, you...
Git log offers useful options for filtering. This card provides a short overview. By message Only commits that include a...
So you added a new callback to your model that (e.g.) caches some data when it is saved. Now you...
Regular expressions in Javascript are represented by a RegExp object. There also is a regex literal as in many other...
Removing features and merging those changes back can be painful. Here is how it worked for me.\
...To do that, we’ll need to fully specify the component parts, states, and behaviors of the built-in controls, as well as necessary accessibility requirements, and provide test suites...
...reinvent common web UI controls to give designers full control over their appearance and behavior. We hope to make it unnecessary to reinvent built-in UI controls, but for those...
...other methods within the Method class are useful for advanced metaprogramming, though this is beyond the scope of this card. Also see Ruby: Finding where a method is defined
...many :taggings, dependent: :destroy + has_many :posts, through: :taggings +end app/models/tagging.rb +class Tagging < ApplicationRecord + belongs_to :post + belongs_to :tag + + validates :post, uniqueness: { scope: :tag } +end app/controllers/posts_controller.rb def post_params...
...many :taggings, dependent: :destroy + has_many :posts, through: :taggings +end app/models/tagging.rb +class Tagging < ApplicationRecord + belongs_to :post + belongs_to :tag + + validates :post, uniqueness: { scope: :tag } +end app/controllers/posts_controller.rb def new
track down warnings and to see failing specs immediately or to get an overview of the core...
...optional on association declarations with a symbol, lambda or proc. Explanation Association declarations like belongs_to support the option optional. This option does not support symbols, lambdas or procs. If...
...the presence of the associated object won't be validated. Example Bad class Note belongs_to :owner, optional: :draft? end note = Note.new(state: 'created', owner: nil) note.valid? # => true Good
Interactively rebase your current branch onto main, keeping the original base commit (i.e. not rebasing onto main directly).
Ubuntu has a package mysql-sandbox that lets you install multiple MySQL versions into your user home: Install mysql-sandbox...
We're usually running Ubuntu LTS versions. Sometimes newer hardware requires packages from more recent Ubuntu releases that only come...
...applications is to make the observe frequency low enough that out-of-order responses become unlikely enough. Try to poll the query field for changes every 0.75 seconds or longer...
...for Rails 2 and 3. Recently, caching with timestamp- or content-based keys has become more popular which saves you the pain of invalidating stale caches. How to enable/disable caching...
...willy@astor.de" And I follow "Cancel account" Then I should see "Account canceled" By going beyond the single line descriptions we've accustomed to, we can provide all the information that...
When deploying a Rails application that is using Webpacker and Capistrano, there are a few configuration tweaks that optimize the...
Rails has the handy controller method send_file which lets us download files easily. We can decide whether the file...
...HTML elements can automatically start playing when the autoplay attribute is set on them. Except for when they can not...
...by doing date on the shell. E.g. our main application servers are running on Berlin (CEST) time, but this will differ on other machines. Rails also assumes that datetime fields...
...Rails 2, open config/environment.rb and comment or remove the config.time_zone line: # config.time_zone = 'Berlin' In order to disable time zone conversion in Rails 3 or newer, open config/application.rb and...