Measuring sql query time of a piece of code using ActiveSupport::Notifications

Posted Over 7 years ago by Andreas Robecke.
api.rubyonrails.org

ActiveSupport::Notifications provides an instrumentation API for Ruby. It is used throughout rails to publish instrumentation events that include information...

How to use Haml in your helpers

Posted Over 7 years ago by Arne Hartherz.

You know those helper methods that just render some HTML but look weird because of content_tags all over the...

Minidusen: Low-tech record filtering with LIKE queries

Posted Over 7 years ago by Henning Koch.
github.com

We have a new gem Minidusen which extracts Dusen's query parsing and LIKE query functionality. Minidusen can no longer...

We are no longer maintaining Dusen

Posted Over 7 years ago by Henning Koch.
github.com

If you were using Dusen for its query parsing and LIKE queries, we recommend to migrate to Minidusen, which extracts...

Using Spring and parallel_tests in your Rails application

Posted Over 7 years ago by Arne Hartherz.

You want Spring for super-fast binstubs like bin/rails or bin/rspec which avoid Rails boot time. You want parallel_tests...

An intro to Javascript promises

Posted Over 7 years ago by Dominik Schöler.

Promises are the new way™ to express "Do this, and once you're done, do that". In contrast to callbacks...

MySQL: How to dump single tables instead of a complete database

Posted Over 7 years ago by Emanuel.

Sometimes you want to test migrations with production or staging data. Dumping single tables makes sense if a complete dump...

Rails: How to get PostgreSQL version being used

Posted Over 7 years ago by Arne Hartherz.

To check the currently running PG version from your Rails application (e.g. Rails console on your production server), simply do...

Case sensitivity in PostgreSQL

Posted Over 7 years ago by Tobias Kraze.

PostgreSQL, unlike MySQL, treats strings as case sensitive in all circumstances. This includes comparison with = and LIKE collision detection in...

Building web applications: Beyond the happy path

Posted Over 7 years ago by Dominik Schöler.

When building a web application, one is tempted to claim it "done" too early. Make sure you check this list...

There is no real performance difference between "def" and "define_method"

Posted Over 7 years ago by Arne Hartherz.
tenderlovemaking.com

You can define methods using def or define_method. In the real world, there is no performance difference.

ActiveRecord subselects - Today I Learned

Posted Over 7 years ago by Henning Koch.
til.hashrocket.com

Apparently you can pash a second scope to a hash-condition and the whole thing will be evaluated as a...

has_one association may silently drop associated record when it is invalid

Posted Almost 8 years ago by Dominik Schöler.

This is quite an edge case, and appears like a bug in Rails (4.2.6) to me. Update: This is now...

Download Ruby gems without installing

Posted Almost 8 years ago by Henning Koch.

You can download .gem files using gem fetch: gem fetch activesupport consul This will produce files like active-support-5.0.0.gem and consul-0.12.1.gem...

Linux: Find out which processes are swapped out

Posted Almost 8 years ago by Thomas Eisenbarth.

Processes in Linux might be put into Swap ("virtual memory") occasionally. Even parts of a single process might be removed...

Tasks, microtasks, queues and schedules - JakeArchibald.com

Posted Almost 8 years ago by Henning Koch.
jakearchibald.com

The way that Javascript schedules timeouts and promise callbacks is more complicated than you think. This can be the reason...

Rails Env Widget

Posted Almost 8 years ago by Dominik Schöler.

Have you ever mistaken one Rails environment for another? The attached helper will help you to never do it again...

Dynamically uploading files to Rails with jQuery File Upload

Posted Almost 8 years ago by Dominik Schöler.

to create a Gallery that has a name and has_many :images, which in turn have a...

How to explain SQL statements via ActiveRecord

Posted Almost 8 years ago by Arne Hartherz.
guides.rubyonrails.org

ActiveRecord offers an explain method similar to using EXPLAIN SQL statements on the database. However, this approach will explain all...

Introducing Helix: Rust + Ruby, Without The Glue

Posted Almost 8 years ago by Henning Koch.
blog.skylight.io

Helix allows you to implement performance-critical code of your Ruby app in Rust, without requiring glue code to bridge...

rroblak/seed_dump

Posted Almost 8 years ago by Henning Koch.
github.com

This gem gives you a rake task db:seed:dump do create a db/seeds.rb from your current database state.

VCR: An OAuth-compatible request matcher

Posted Almost 8 years ago by Dominik Schöler.

OAuth requires a set of params to be carried along requests, among which a nonce. Some libraries pass these along...

Postgres Index Types

Posted Almost 8 years ago by Henning Koch.
robots.thoughtbot.com

When creating an index using CREATE INDEX, Postgres will create a B-Tree type index by default. The B-Tree...

jQuery promises: done() and then() are not the same

Posted About 8 years ago by Henning Koch.

jQuery's deferred objects behave somewhat like standard promises, but not really. One of many subtle differences is that there...