Tutorials

Know what your scopes are doing: where.first vs find_by - Andy Croll
There are numerous benefits to using an Object-Relational Mapper (ORM), such as Active Record, to generate your SQL. You gain from clear repeatable abstractions, saving time and improving readability.Unfortunately the very abstractions that make a...





Rails 7 allows permitting numeric params | Saeloun Blog
In Rails, strong params provide an interface for protecting attributes from the end-user assignment. We can specify required attributes and neglect unnecessary attributes to be used in the Active model mass assignment. However, in Rails 6, there w...

How we automatically fixed thousands of Ruby 2.7 deprecation warnings | GitLab
To address this warning, the obvious, and boring solution was to simply add ** to the last keyword argument. For the most part, this is what we did. However, while this was under way, we also developed a RuboCop check that could detect, and automa...

PostgreSQL zero-downtime migration of a primary key from int to bigint (with Ruby on Rails specific notes)
A primary key integer field approaching overflow is a devops nightmare. We explain step by step to how we made the migration with zero downtime.You have an auto increment primary key int field and it’s nearing the maximum value for int: 2,147,483,...

Don't waste your time on assets compilation on Heroku | Arkency Blog
At some point, you may want or be forced to use the CDN to serve assets of your Rails app. When your app is globally available, you may want to serve the assets from strategically located servers around the world to provide the best possible exper...