Here are some popular mistakes when using nested forms: You are using fields_for instead of form.fields_for.
When projects run for many years, they require special regular maintenance to stay fresh. This kind of maintenance is usually...
...use ActionDispatch::RemoteIp use Rails::Rack::Logger use ActionDispatch::ShowExceptions use ActionDispatch::DebugExceptions use BetterErrors::Middleware use ActionDispatch::Reloader use ActionDispatch::Callbacks use ActiveRecord::Migration::CheckPending use ActionDispatch::Cookies
...need a library for it. With ActiveRecord you could implement it with a single belongs_to association: class Node < ActiveRecord::Base belongs_to :parent, class: 'Node' end Any modification of...
Before any technical considerations, you need to understand the old system as best as possible. If feasible, do not only look at its API, or database, or frontend...
CarrierWave comes with some RSpec matchers which will make testing more comfortable. Let's say you have an Uploader like...
RSpec allows you to mark a single Example/ExampleGroup so that only this will be run. This is very useful when...
...timing in your tests, this requires a lot of work and sustained diligence. A better approach is to use feature flags to only enable these features for the one test...
...is something that we fixed in the code, not the test. The code is better now. However, it took a day to find a bug that no user has seen...
...use a library like Lodash or Unpoly's up.util that will hide this inconsistency behind functions like _.isBoolean(x) or _.isObject(x). However, I encourage every JavaScript developer to understand...
...JavaScript has a caveat that typeof null returns 'object'. No developer would consider this behavior useful, since you cannot get or set properties with null. Taking into consideration all of...
...many thousand rows. Once your database tables grows to millions of rows, migration performance becomes an issue. We will talk about this in another card. 1. Use the full power...
...updates with it. As a first example, we have Post has_many :followers. For better performance, we want to cache the number of followers in Post#followers_count.
...this issue for PATCH/DELETE. If you make requests yourself, watch out for the following behavior. When you make an AJAX request PATCH /foo and the /foo action redirects to /bar...
SVG files often contain redundant information, like editor metadata or hidden elements. When esbuild handles your static assets, you can...
...test (of course, you should be using parallel_tests). However, in projects that go beyond clicking around in a web GUI and checking results, there might be various measures to...
...even the worst method had time average saving of 00:54 minutes and the best 01:11 minutes. For 25 commits per day this would be an average time saving...
...have not been normalized to the total execution time of the testsuite. A cost benefit analysis could give greater insight into the amortization of costs and about the actual time...
"Special object attributes" like frozen, tainted and singleton methods are ignored (like dup) Behavior depends on implementation Hash: returns a deep copy, i.e. referenced objects/values will be deep_duped...
...not waste your time optimizing code where it does not even matter. However, I believe there are some kinds of optimizations you should do right away, because they are either...
...how a library works. This is especially true for all polyfill that fix browser behaviours with all weird kinds of tricks. In your own scripts, don't add event handles...
...if .second-item could be rendered smaller without problems or has because you defined behavior for it. +---------+--------------------------------------+ | | - 1000 characters looooooooooooong | | +---------+--------------------------------------+ Try it on CodePen. There are two ways to fix...
...may just set overflow: hidden or maybe on .second-item and/or add some overflow behavior and you're done. In some cases, this might not be the solution because the...
This card existed before, but was outdated due to browser implementation changes. The information below is validated for the current...
For Sidekiq to be able to retry your jobs it has to be able to catch errors that occur while...
...simply type orca in your terminal. Note It may feel quite strange in the beginning to use a screen reader. It is constantly commenting on everything you do and every...
Handling I have noticed, while testing my application, that the screen reader sometimes behaves a bit weirdly if you are using the mouse to navigate the page. It would...
...should help understanding the basic concepts of Ruby's object model and how things behave. Usage of objects in Ruby When working with objects in Ruby, you might think of...
...declare instance methods. This may seem completely counterintuitive. The reason is that class_eval behaves as if you would open the class manually and then write code into it. The...
Debugging performance issues in your Rails app can be a tough challenge. To get more detailed insights consider using the...
An introduction to mangling When you minify ("compress", "optimize") your JavaScript for production, the names of your functions and variables...
...would hand you UTC objects whose to_s(:db) may not convert properly. Legacy behavior in Rails 2.3 It's been briefly mentioned in the random list of ActiveSupport goodies...