RubyFlow : The Ruby Community Blog

Home   Submit   Sign Up   Log In   leaders   Twitter   RSS Feed  
November 25, 2014
How to create a service object?
How to split big services?
How to handle dependency injection? Find out
String interpolation in Ruby is great. It’s one of those niceties that I really miss whenever I venture into JavaScript land. But watch out! There are some lesser known “features” of Ruby’s string interpolation that can burn you… badly. Learn how.
This article writes about speeding up a rails rest suite significantly by avoiding common pitfalls. This part of the series talks about cucumber improvements and using poltergeist.

How I sped up our Rails Test Suite by 267%
Each... or else
I love each, but I have a problem with it. How do you handle an empty collection?
Version 5.0.0 beta 1 of the popular Phusion Passenger app server has been released. This release is codenamed "Raptor", is much faster, helps you better identify and solve problems, and has a ton of other improvements.
Beyond The Rails Way
Is there life beyond The Rails Way?

Let's find out!

Beyond The Rails Way
Log tagging in Rails
Whilst deploying a large application to Heroku, we needed a way to trace application requests from the second they come into the router through to when the request completes. Enter log tagging.
November 24, 2014
Four years after its initial release, no_querying_views is now a gem. Querying views - views triggering DB queries - will now raise an exception !
In this article you can find my 5 cents about this subject. There are 5 approaches which may help you. It is not about patterns, but it is about making decisions and architecture of an application. There is one approach which started working well for us.
Today Ruby Object Mapper v0.3.0 was released. Here's the official announcement.
ITTIA DB SQL solves challenges such as merging data, efficient communication, and security, which allows Android (TM) tablets to access call center data stored in an existing relational database, such as Microsoft(R) SQL Server(R), or Oracle(R) Database. With this technology a call center can rapidly improve communication to experience significant time and cost savings through greater efficiency.
Performance in any app is Critical. In this post on Ruby string key performance we'll look at some optimizations you can make in your app today, and how the Ruby 2.2 interpreter will help make your code faster for free.
Ruby Book Giveaway Extravaganza
I just launched the Ruby Book Giveaway Extravaganza. Three winners, Five books, a 6 month Safari Online membership, and $50 in your name to The Ada Initiative or another tech charity of your choice. The books are: Practical Object Oriented Design in Ruby (POODR) by Sandy Metz, Clean Ruby by Jim Gay, Exceptional Ruby by Avdi Grimm
I just wrote a post, how to cache database queries in memcache to boost up your application performance Read the post here and please give feedback
I've released tty-screen to allow for cross platform screen size detection. This is another component for tty.
November 23, 2014
Flip Flop Operator in Ruby
The flip flop operator is one of those weird features of Ruby that most people aren’t even aware of. It’s one of the many Perlisms that sneaked into Ruby, but hasn’t caught on. In this post, we will look at what flip-flop operators are, and where you can use them.
Just published ApiView as a performance focused serializer with a slim and lean code base.

The difference between ActiveModelSerializer can be up to 10x faster JSON response, not something to sneeze upon!
Please checkout and enjoy!
ComfortableMexicanSofa Rails 4 CMS Engine version bump.

See Release Notes for details
November 22, 2014
Pastel v0.4.0
Pastel allows now for detaching common style combinations, as well as for nesting of styled strings by using blocks. Please give it a try and let me know what you think!
The 1.0 release of Clean Ruby is here!
Anyone who bought it has received a new download link, but I wrote a bit about my experience and what people have to say.
I was displeased with any of the (yet so many) libraries for generating colored console output, so I wrote my own: hansi.


8 color, 16 color, 88 color, 256 color and 24 bit (True Color) mode
converts colors between modes
proper color nesting (this is broken in highline, which is what I'm using in most of my projects right now)
automatically detect proper mode for current terminal
does not come with a Ruby DSL
supports string templates (optional)
supports themes (optional)
zero dependencies
full test coverage
no monkey patches
November 21, 2014
I wrote a new post about forwarding messages to an object that might be nil and what to do with your code.
Raptor is a cool new app server that's up to 4x faster than Unicorn, up to 2x faster than Puma, Torquebox. This second article describes many techniques that has made Raptor so fast. It's the second part of a blog series on Raptor performance optimization.
November 20, 2014
Generating Descriptive Statistics in Ruby and Rails. The core Ruby libraries do not provide an easy way to calculate simple descriptive statistics on collections of numbers. However, this can be easily achieved using the DescriptiveStatistics Gem.
Unicorn Unix Magic Tricks
I just published the blog post version of my talk Unicorn Unix Magic Tricks. It looks at how the Unicorn webserver works in great detail and explains the underlying Unix concepts which it uses to leverage the power of the operating system. It's a really detailed (and long) blog post that shows how forking, system calls, signal handling, pipes and Unicorns master-worker architecture work.
RubyGems started with a single marshaled file called Marshal.4.8.gz containing the array of every Gem::Specification object for every gem that has been uploaded to RubyGems directory. Since then we have new indexes for RubyGems to speed things up, but good old Marshal.4.8.gz is still around carrying important information about gems from Are you interested to know what is and what is not there and finally understand why gem specification rails -r does not give you the information on licensing even though it’s part of rails’ gemspec file? Read more
Using service objects as replacement of strong params makes controller validation easy and complete. Check our gem here: ParamsFor. Thx and happy coding.
November 19, 2014
Cache-Control directives are pretty straightforward to understand. They're easy to use as well if you assume that all the caches between your end user and application correctly implement the spec. Unfortunately, as with any spec, you can't make that assumption. You need to be aware of any spec misinterpretations in the implementation of the caches that you're using, and properly account for them. Learn How to Get Cache-Control Right
In a recent episode of the RubyRogues podcast, Martin Fowler and Jessica Kerr illustrated Healthy Codebase and Preparatory Refactoring with beautiful words and powerful metaphors. I share those in this article.
Ruby is a great programming language to write DSLs - unfortunately often developers monkeypatch Object to define top level scope methods. There is a better way that does not pollute Object with unnecessary methods.
Refactoring - WHY? opens a short series of blogposts answers the “why”, “how” and “when” of code refactoring.
I wrote a new post on Creating Rails Active Record Validation Contexts with Inheritance. Hope you enjoy!
Sublayouts in Rails in 3 easy steps.
November 18, 2014
If you don’t know the difference between the various Ruby and Rails consoles, you’ll have some problems. Maybe you’ll require a file and get the wrong version. Or a library you thought would be avaliable, wasn’t. So how do you make sure you’re using the right console at the right time?
How to get your app running on the SAP HANA cloud platform.
November 17, 2014
Do you hate fixtures? I do as well.

VCR is a good library for stubbing HTTP interactions, but it is very difficult to maintain dozen cassettes in the project. If you feel the same and you want spend less time on understanding what is wrong with your cassettes, you may find this article useful. Let me know what your thoughts are about that.
Typekit,, and other font services or external APIs can slow down your JavaScript integration tests. Speed up your tests with this setting.
ReadActivity supports model to track read/unread status for a specific time, like 'Seen by 99' on Facebook. Please check out my GitHub.
Last week, we released the activerecord_sane_schema_dumper gem (extracted from an initializer we’ve been using for months) in order to generate a clean db/schema.rb file with Rails. It strips useless (and harmful) alignment whitespace from the file so changes to your DB columns doesn’t affect irrelevant lines.
Build a Ruby Gem is 25% off until the end of RubyConf. Hope you enjoy!
Today I'm Open-sourcing Aloo - my Rails Rumble 2014 submission. Aloo is GIST for data - uses Rails and Redis.
I've just released a new version of stream-rails. A gem to create activity feeds and newsfeeds with Ruby on Rails. The gem comes with a very basic example app that you can deploy to Heroku.
November 16, 2014
finite_machine gets better with alias_target method and log_transitions option. Please see documentation for full interface.
The last post in the intro series on Rubinius 3.0 talks about some exciting changes to the language.
November 15, 2014
I'm an avid user of Forwardable from Ruby's standard library. My latest article explains why you can make shorter, simpler code with Forwardable and hide the noise of boilerplate Ruby code.
I just released tty-spinner for drawing spinning animations in terminal emulators.
November 14, 2014
Here Brian introduces the subsystems of Rubinius: GC, JIT, Metric, UI, and CodeDB.
Clojure Loops in Ruby
An article that builds Clojure style loops in Ruby using continuations. Not recommended for pregnant women or individuals with pre-existing heart conditions.
Action Access is an access control system for Rails that provides a modular and easy way to secure applications and handle permissions. It works at controller level focusing on what actions are accessible for the current user instead of messing with models and their attributes. Read more »
Using spring with pow!
The other day I was a bit sad for I was aware that pow (the web server) wasn’t leveraging spring (the Rails preloader) with its fast load times. Read more »