When using send_file (for example for attachments of any kind), make sure your application knows the correct mime types...
# Given the following models class Image < ActiveRecord::Base has_many :album_images has_many :albums, through: :album_images
When ending a Selenium test Capybara resets the browser state by closing the tab, clearing cookies, localStorage, etc.
You know that ActiveRecord caches associations so they are not loaded twice for the same object. You also know that...
Instead of this: Image.order('images.created_at DESC') You can write this: Image.order(created_at: :desc) Not only do you not...
It's generally not trivial to change a datetime's seconds, minutes, etc in SQL. Here is how it works...
Web applications can be used by multiple users at the same time. A typical application server like Passenger has multiple...
You can hook into Slack when using Capistrano for deployment. The slackistrano gem does most of the heavy lifting for...
See this Railscast. Basically you can simply write views like index.xlsx.erb: ID Name Release Date Price <% @products.each do |product| %> <%= product.id...
Write a // and indent every subsequent line by two spaces. This is great for documenting BEM blocks! // An action button...
SELECT table_name, table_rows FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA = 'your_database' order by table_rows;
Good article about window functions. Also note how they use a postgres feature called common table expressions.
This guide shows how to create an AngularJS application that consumes more and more memory until, eventually, the browser process...
The linked article explains how to get a database-wide lock without creating table rows: This article explains how I...
Postgres 9.4 introduces a new column type: jsonb. json and jsonb columns store data differently, so just compare the two...
When you are using the #selector_for helper in Cucumber steps, as e.g. Spreewald does, the following snippet will save...
When running migrations with rake db:migrate, there's the STEP and VERSION parameters that you can pass to nearly...
tldr; Use git diff -M or git diff --find-renames when you've moved a few files around. Usage
This will list all branches matching your query as input options for git checkout greckout ar 1) ar/cache-api-keys-1098...
If you want to load an SQL dump from an ActiveRecord migration, you might find this to be harder than...
Geordi 1.0 features a command line application geordi, that holds most of Geordi's previous commands. New features
Add gem 'database_cleaner' to your Gemfile. Then: Cucumber & Rails 3+ # features/support/database_cleaner.rb DatabaseCleaner.clean_with(:deletion) # clean once, now DatabaseCleaner.strategy = :transaction...
Some insight into how browser rendering engines work. The article shows how the way you manipulate styles (and the DOM...
Sequel is an awesome ORM such as ActiveRecord. The linked article describes how easily you can implement and use materialized...