You should avoid using application models in your migrations. But how else could you create records in a migration?
When writing XLSX files, there are gems like rubyXL or axlsx. While they do offer features like formatting or graphs...
PostgreSQL's Common Table Expressions (CTEs) can be used to extract sub-queries from bulky SQL statements into a temporary...
PostgreSQL supports the SQL OVERLAPS operator. You can use it to test if two date ranges overlap: => SELECT ('2001-02...
Git has two kind of tags: annotated lightweight Annotated tags are stored as full objects in the Git database. They...
We're usually running Ubuntu LTS versions. Sometimes newer hardware requires packages from more recent Ubuntu releases that only come...
An end-to-end test (E2E test) is a script that remote-controls a web browser with tools like Selenium...
Slides for Henning's talk on Sep 21st 2017. Understanding sync vs. async control flow Talking to synchronous (or "blocking...
When you want to group rails models of a logical context, namespaces are your friend. However, if you have a...
After loading a staging dump into development, you might get an ActiveRecord::EnvironmentMismatchError when trying to replace the database (like...
If another session is accessing your database you are trying to reset or drop you might have seen the following...
I frequently find myself needing a combination of group_by, count and sort for quick statistics. Here's a method...
before(:all) runs the block once before all of the examples. before(:each) runs the block once before each...
There are many approaches out there how you can import data from a legacy application to a new application. Here...
Use Traim to build a RESTful API for your ActiveRecord models with very little code. Traim assumes your API resources...
When using GROUP BY, MySQL now complains if the SELECT includes columns which are not part of the GROUP BY...
Rails supports time zones, but there are several pitfalls. Most importantly because Time.now and Time.current are completely different things and...
Dump this method into your Ruby console to quickly print data in columns. This is helpful for e.g. comparing attributes...
Database connections are not thread-safe. That's why ActiveRecord uses a separate database connection for each thread.
This card compares patterns to store trees in a relation database like MySQL or PostgreSQL. Implementation examples are for the...
The parallel-gem is quite easy to use and can speed up rendering time if you want to render the...
This card is just about creating simple PostgreSQL dumps. This is no instruction for a backup strategy nor a guide...
Hint This applies only to distributions based on Debian. Requirement You need to setup the PostgreSQL Apt Repository first.
on the bash (issued as postgres user) Start/Stop/Restart PostgreSQL pg_ctl -D $configdir start|stop|restart Start/Stop/Restart the corresponding PostgreSQL...