Newer versions of Bundler (at least since 2.3) have two different behaviors: If your Gemfile.lock reads PLATFORMS: ruby, it might either install a compatible platform-specific version...
...or similar), bundler will install exactly the versions indiciated in the Gemfile.lock. Fix For better consistency, I would advise to make sure you always have PLATFORMS x86_64-linux
PostgreSQL can cosplay as a full-text search engine. It doesn't have the features or fidelity of ElasticSearch or...
...like using the /slackfont command. Fonts need to be installed on your machine. Webfonts beyond those provided by Slack won't magically work unless you install them locally.
ActiveModel supplies an errors object that behaves similar to a Hash. It can be used to add errors to a record, as well as to query the record for registered...
...until we know for sure which image version we will need and the solution becomes very simple. Here is a small helper function for your mailer views: def inline!(version...
Redis.current will be removed without replacement in redis-rb 5.0. Version 4.6.0 adds deprecation warnings for Redis.current and Redis.current=: `Redis.current...
tl;dr Individual transform properties are great because they allow you to write more readable and maintainable CSS, especially when...
Look-arounds provide a way to match context-dependant. You can look-behind, look-ahead and to both in a positive and negative way. The look-around will...
...Modifiers in Ruby Add modifiers after the final slash, e.g. /Regex/im, or at the beginning of the regex, e.g. /(?i)regex/. i: case insensitivity m: make the .-character also match...
Say you wrap your index view in a form to apply different filters like pagination or a search query. On...
...way to calculate the signature is to use an HMAC. Unfortunately, I don't believe you can calculate a proper HMAC in a regular Apache installation. Instead, we do something...
Important You should only implement an implicit conversion method if your object already behaves like the target type. You never create a new object in an implicit conversion method...
...either return self or not be implemented at all. Obviously, this is the reason behind this recent card about Ruby implicitly converting a hash to keyword arguments. It's not...
Programatically invoke Rails generators Require the generator, instantiate it and invoke it (because generators are Thor::Groups, you need...
2013-02-20 (Tobias) ... with exactly the following rows 2012-06-20 (Henning) Better normalization (more consistent for expected/real input, gets rid of nbsps) 2012-06-01 (Tobias)
...wildcard support (partial matches) 2012-05-25 (Tobias) Better error output; "should not see" now fails if any of the rows is present; cells are now matched exactly, wildcard for...
Webpacker uses Babel and Webpack to transpile modern JavaScript down to EcmaScript 5. Depending on what browser a project needs...
Looking at the source code of the validates_numericality_of validator, it becomes clear that it converts the attribute in question to either an integer or float: if configuration[:only...
...ActiveRecord::Errors.default_error_messages[:not_a_number]) next end raw_value = raw_value.to_i else begin raw_value = Kernel.Float(raw_value.to_s) rescue ArgumentError, TypeError record.errors.add(attr_name, configuration[:message] || ActiveRecord::Errors.default...
...class Image < ActiveRecord::Base; end class Video < ActiveRecord::Base; end class PageVersion < ActiveRecord::Base belongs_to :primary_medium, polymorphic: true # may be Image or Video end class Page < ActiveRecord::Base...
...belongs_to :current_version, class_name: 'PageVersion' end Now, when you load pages and include their current versions' primary media... Page.includes(:current_version => :primary_medium).to_a ... Rails will produce...
...NonExistentClass".constantize # => NameError: uninitialized constant NonExistentClass Dynamic Programming In scenarios where your application’s behavior depends on dynamic constant resolution, safe_constantize may offer a more convenient control flow to...
How a macro can dynamically define a method that can be overridden with super in the same class.
Ruby 3.0 introduced a breaking change in how it treats keyword arguments. There is an excellent blog post on the...
If you want to collapse/expand elements with dynamic content (and thus unknown height), you can not transition between height: 0...
Git commits should be very deliberate, and only contain changes that you really want to be in there. In order...
Some pseudo-elements need to be addressed with vendor prefixes. E.g. ::selection is not supported by Firefox, you need to...
The change_column method for rails migrations support casting with a custom SQL statement. This allows us to change a...
We had a card that described how to install multiple mysql versions using mysql-sandbox. Nowadays with the wide adoption...