RubyFlow : The Ruby Community Blog

Home   Submit   Sign Up   Log In   leaders   Twitter   RSS Feed  
November 28, 2014
I've uploaded a new sportdb gem update, that is, v1.9.14. What's news? The sportdb gem that lets you load datasets (e.g. teams, leagues, matches, etc.) in plain text into your SQL database of choice now includes a new build system. Use the new Datafile - a mini language a.k.a. domain-specific language (DSL) that lets you setup your database in minutes. For example, to setup a football.db for all World Cups 1930-2014 use the worldcup.rb quick starter template. Type $ sportdb new worldcup to download the datasets (as zip archives), setup all tables, indexes, etc. and read in all fixtures. Cheers.
November 27, 2014
Humanity and community was omnipresent at RubyConf 2014. Guess what? I wrote a blog post about it!
I share some tips, I used to fight memory leaks when manipulating images with RMagick.
I just wrote a post about the challenges when developing a little larger API-only Rails project. I think Rails is good but needs some improvements in some areas. Check it out and let me know if you agree/disagree :)
Our new tutorial on how to send emails in a Rails app. We covered topics of ActionMailer, ActionMailer Preview, Sending emails with a third party service (Gmail and Mailgun) and finally, using Active Job to send emails in the background. 

How to Send Emails in Rails
I just launched Dante wysiwyg. It's just another editor clone. it has many of the medium wysiwyg features, and is in our roadmap to get 100% of the features that medium editor has. It comes with asset-pipeline (rails/sprockets) integration out of the box.
I finally snapped and no longer wanted to see Google ads while developing my Rails app. This was my solution.
November 26, 2014
I just released a spin-off of middleman-presentation. It's a webserver which serves a local directory only without any configuration. You can find it here. Beware it's written in Go.
Most of the time you'll spend debugging applications written with Opal you'll be fine using just these three tricks.
Ania Ślimak came up with the idea of how to deal with a large number of guards in multiple modules using “chdir” option of “guard” gem. Read about it on the Lunar Logic blog.
Minispec uses native Ruby methods for testing:

is(a) == b

More examples
Fixing Fixtures
For a long time, using Rails fixtures was considered bad form, but in recent years, a lot of developers have come back around to using them. This post provides tips and practices for simplifying your fixtures and making them easier to manage.
Often times we don’t want an HTTP client to blindly cache content that it has been given. We may not be able to rely on setting specific expiration headers either. Instead we need a way for the client to ask the server whether or not a resource has been updated.

HTTP provides us with the ability to do this with conditional caching. A client can make a request to the server and find out of the server has a new version of the resource available. Rails provides us with tools to take advantage of this.
November 25, 2014
Ready for a holiday side project? If you've got Rails 4.2, you can use Rails Composer to build a Stripe Checkout starter application that combines payment processing with Devise. Here's the Stripe Checkout Example application. There's also a tutorial.
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.