Articles
-
Running Rails in production mode locally
Sometimes it’s useful to run a Rails app in production mode locally for testing purposes. This may not always be feasible depending upon the complexity of the project, but when it is, the following steps can be followed.
-
Fetching database metadata in Rails
Here’s how to retrieve information about application tables in Rails, demonstrated from the Rails console (
rails console
orrails c
): -
Counting word frequency in vim
vim does not have a method to count word frequency by default, but it is easily added in a function.
-
Failing fast when running PostgreSQL scripts
When running scripts against Postgres with the
psql
client, errors will accumulate by default. This is good from the perspective of resiliency, but may not always be desirable behavior, especially with a long-running script. -
How to create deprecation warnings in Rails
Sometimes it is necessary to override inbuilt functionality of Rails (or other dependencies) by creating a monkey patch. However this may only be intended as a temporary solution, waiting on some future fix or upgrade to the framework.