For webpages to load fast it's recommended to optimize images. Ideally an image's file size should be as...
Developing or debugging SAML functionality can be a hassle, especially when you need to go back and forth with someone...
def self.acquire(name) already_acquired = definitely_acquired?(name) if already_acquired yield else begin create(:name => name) unless find_by_name(name) rescue ActiveRecord::StatementInvalid # concurrent create is okay...
begin result = nil transaction do find_by_name(name, :lock => true) # this is the call that will block acquired_lock(name) result = yield end result ensure maybe_released_lock...
Why secure-only cookies used to be necessary Cookies have an optional secure flag. It tells the browser to not...
...for all exceptions (previously true) :none: It will raise for all exceptions (previous default behavior, value false) Using the new default needs to change a RSpec test like this:
...used when you are working on a branch and make a new commits which belongs to a previous commit. If the previous commit is the last commit, you can also...
Even though the process in #1 could be used for this it can become quite tedious if you have a large commit and might have already done this and...
available for button, fieldset, input, select, textarea, command, keygen, optgroup, option Browser specific behavior: IE 11: text inputs that are descendants of a disabled fieldset appear disabled but the...
Deep dive Okay, so the example above has at least one obvious benefit: You do not have to put self.table_name_prefix = "universe_" into each of your classes...
...it. It's not read at all. Here is why (follow links for a better understanding): An ActiveRecord class will pick the table_name_prefix of any of its module...
CarrierWave comes with a set of default configuration options which make sense in most cases. However, you should review these...
When deleting a record in your Rails app, Carrierwave automatically takes care of removing all associated files. However, the file...
Rails default config uses the ActiveSupport::Cache::NullStore and disables controller caching for all environments except production: config.action_controller.perform_caching = false...
In a project team for a bigger project people have several roles: Developer: at makandra Project lead: at makandra
You want to use fields in your applications. However, your desktop users may encounter some weird quirks: Aside from allowing...
...addition of both margins takes place but the maximum of both is applied. This behavior is called collapsing margins. Oftentimes it is a good behavior but collapsing margins can be...
...the previous sibling of the parent box. Nevertheless there are some exceptions where the behavior of vertical collapsing margins is not used. Exceptions when margins do not collapse
...for Structs are temporary data structures which just hold state and don't provide behaviour. In many cases you could use a simple hash as a data structure instead. However...
...are incredibly fast. If you have to handle lots of data it may be better to use hashes for performance reasons, even if the readability of the code suffers compared...
...in an encrypted YAML file. Usage is simple: each key in the credentials file becomes a method on Rails.application.credentials, returning the corresponding secret. # Credentials file file_storage_secret: superstrongsecret
We have now updated/created two gems that implement the requirements above using the best practices we know of: assignable_values: ActiveRecord macro to restrict the values that may be...
It's 2024 and we have tools like ffmpeg, imagemagick and GPT readily available. With them, it's easy to...
...move elements to the back (e.g. background images, gradients etc). They will be rendered behind all other elements within the context (e.g. text), but not behind elements outside the stacking...
Full-text search can reach its limits in terms of flexibility and performance. In such cases, trigram indexes (pg_trgm...
...or newer versions for these libraries before you start. Maybe you can upgrade them beforehand which makes the migration easier. Here are some libraries that I had come across:
...implement the navigation on your own. Tip: Add a feature for your navigation bar beforehand and test links and their highlighting (don't forget dropdown submenus!). After upgrading to Bootstrap...
In Rails 8 the behavior of the rails db:migrate command has changed for fresh databases (see PR #52830). Before Rails 8: The command runs all migrations in the folder...
The value of the Unicode byte-order character placed at the beginning of the file (BOM). The value given by the charset attribute of the Content-Type...
Today I learned that you can animate HTML elements using the Web Animation API's method .animate(keyframes, options) (which...