When ActiveRecord child objects are autosaved in Rails.
Note: This applies to plain Ruby scripts, Rails does not have this issue. When you work with Ruby strings, those...
Ruby 2.3.0 has been around since end of 2015. It brings some pretty nice new features! Make sure to read...
As announced before, Ruby has introduced a safe navigation operator with version 2.3.0. receiver&.method prevents NoMethodErrors by intercepting method...
Ever needed to use a global variable in Rails? Ugh, that's the worst. If you need global state, you...
Have you ever mistaken one Rails environment for another? The attached helper will help you to never do it again...
As your Rails project grows, you will accumulate a number of small patches. These will usually fix a bug in...
to create a Gallery that has a name and has_many :images, which in turn have a...
UI sortable helps reordering items with drag 'n drop. It works quite fine. Proven configuration for sorting table rows
When you have a localized website, you may want to redirect users to their preferred language when they visit the...
When you run rake db:rollback and nothing happens, you are probably missing the latest migration file (or have not...
Adds missing native PostgreSQL data types to ActiveRecord and convenient querying extensions for ActiveRecord and Arel for Rails 4.x...
When dealing with time zones in Rails, there is one key fact to keep in mind: Rails has configurable time...
When building a form with a file select field, you may want to offer your users a live preview before...
Tool to show you which gems are slow to load: ➜ git:(master) ✗ bundle exec bumbler [################################################# ] (49/65) travis-lint...
To upload a file via AJAX (e.g. from an ) you need to wrap your params in a FormData object.
If you want to inspect the compiled code of your erb (or haml) templates, you can run the following code...
Don't write resources :people, :concerns => :trashable Write resources :people do concerns :trashable end Why Writing a controller...
TL;DR There are three dimensions you can control when scoping routes: scope module: 'module', path: 'url_prefix', as: 'path...
Our preferred way of testing ActiveRecord is to simply create/update/destroy the record and then check if the expected behavior has...
Validations should be covered by a model's spec. This card shows how to test an individual validation. This is...
A HTTP 302 Found redirect to PATCH and DELETE requests will be followed with PATCH or DELETE. Redirect responses to...
From Rails 3.0.9, there is a method Hash#to_query that will turn a Hash into a query string:
I got this error when running Rails 2.3 tests for Rails LTS. More stacktrace: NoMethodError: undefined method `cache' for Gem...