RubyFlow : The Ruby Community Blog

Home   Submit   Sign Up   Log In   leaders   Twitter   RSS Feed  
November 11, 2014
There are plenty of reasons users will want to sort and reorder lists, but implementing such a feature when using the has_many :through association isn't so obvious. In this post I'll show you how this is possible using the ActsAsList gem, and along the way show you how to load seed data, create a has_many :through relation, and use the great table_print gem. Read the post.
Almost every SaaS product has a free trial period. Why? At first, I thought it's to get as many people to try the product, but that doesn't make sense. The real reason is to create an "endowment effect."
Have you ever wanted to pass a method to a function that only takes a block? Or figure out which of your object's superclasses broke the method you're trying to call? Those things are easy to do with the method method. Use it well, and you can learn about your dependencies, save yourself hours of debugging, and get your code to the places it needs to be.
rb_import adds an import method to the Ruby VM so one can do foo_class = import './foo.rb'.
Eventually name-clashing class/module definitions can now be prevented with this gem.
November 10, 2014
Say hi to the Rubinius Team! News on Rubinius 3.0 coming soon too.
Raptor is a new Ruby web server that's up to 4x faster than Unicorn, and up to 2x faster than Puma and Torquebox. The most recent blog post describes in high detail how it has been made so fast. It's the first post from a series that will elaborate on Raptor's implementation.
Tail call optimization is an optimization where tail recursive functions are transformed into loops by the compiler. A tail recursive function is one where the final statement is a call to the same method. In this post, we will look at what tail recursive functions look like, how tail call optimization helps them, and how to enable TCO in Ruby. [Continue reading]
Let Austen Ito show you how he builds a basic infrastructure with Docker, Chef, and Rails!
Location-based web applications calculate distance between objects using the latitudinal and longitudinal coordinates and the Haversine formula. But how does one determine an object's coordinates given a street address or IP address, let alone calculate the distance between two sets of coordinates? Fortunately the Geocoder gem turns these otherwise complex tasks into a fairly trivial matter. In this post I'll show you to to integrate Geocoder into your Rails application.
Get a smaller Rails app footprint with two commands. A 36% boot time memory savings for free. Also learn how to benchmark and optimize your own application's boot size.
Pakyow v0.9 Release
Pakyow, the view-first app framework for Ruby, dropped over the weekend. Release notes + upgrade guide.
liquid-rails allows you to render .liquid templates with layout and partial support. It also provides filters, tags, drops class to be used inside your liquid template.
assets-rails allows you to require javascript and stylesheet libraries with the exact version so that your frontend stuffs will continue to work as times passed by. You can use different versions for different templates in a single Rails application.
November 09, 2014
tty-progressbar now includes estimated time token, a frequency option to throttle repainting and ability to log during display. Please check it out and let me know your thoughts.
Some ideas about how to create configurations for ruby programs.
November 08, 2014
Reform 1.2 Is Out!
The popular form object for Ruby and Rails, Reform, got some new amazing features. It now allows dynamic syncing and saving, got a 85% speedup, a dirty tracker and more.
Pastel v0.3.0 released
pastel got even stabler and faster. Fixed bugs concerned with nested styles, improved speed and added ability to alias colors at runtime through environment variable and library interface. This is a component that will be part of tty toolkit
I've just released v0.19 of image_optim with improved gif optimization and new optional lossy worker for jpeg files which uses jpeg-recompress.
I just launched activerecord-after-transaction which provide a function to execute a proc after the transaction.
I wrote a blog post about considerations on Daylight Saving Time when using time zones.
November 07, 2014
Check out your app's stats. The tool is here. The blog post here has example output.
This blog post teaches you that depending on the way you serialize your Date and DateTime values to JSON, you could lose information.

Learn how to avoid that problem.
November 06, 2014
A short walkthrough of how to configure Pronto to do static analysis on every pull request with the help of Travis. Can also be applied to other CI servers.
Sometimes you want to see what's happening in your production log files right now. You can use log management tools like Loggly or Papertrail for this, but there is also an easy way to stream your log files with Capistrano.

Read on
November 05, 2014
A step by step walkthrough of how to make browser to phone calls in Rails using Twilio
I would like to introduce to you a small gem that I released last weekend. It's called scriptster and its aim is to help you make your Ruby scripts a bit nicer (especially those that depend on many external tools).
Hello, As an example of using the beer.db - open public domain beer n brewery data - I've put together a page-a-day "eternal" calendar serving a different beer w/ every request. See a live demo with an all-Austrian taproom or build your own. All code and data is public domain. Cheers. Prost. Kampai.
November 04, 2014
I just finished the 2014 Rails Rumble Gem Teardown, which is a detailed analysis of the gemfiles used by the rail rumble teams. A ton of fascinating stuff this year, including the rise of Bootstrap, Rails Assets usage, Autoprefixer domination, etc.
For anybody using Ninefold and/or Codeship: The two services now integrate.

You can read more here.
When you generate a scaffold in Rails, you'll see the usual respond_to blocks. But some of your actions, like index, don't have them. And those actions, when hit with a bad format, will raise the wrong kind of error. You want to handle bad formats correctly, but littering all your controllers with big respond_to blocks is crazy. It feels un-Rails-ish. So what do you do?
An example of dependency inversion
I recently stumbled on such a good example of the Dependency Inversion principle being applied that I had to blog about it.
November 03, 2014
I wrote this post on using the rails-disco gem to implement Event Sourcing. The basics of ES are explained using a demo Rails app. Boogie!
How do you benchmark rack middleware? Well read this blog post then go make your code faster.
We’re excited to announce the release of The Bike Shed, hosted by Sean Griffin and Derek Prior. It is a biweekly podcast discussing thoughtbot’s experiences in web development.

Episode one, “Sandi and Derek’s Rules” is now available for download. Sean and Derek discuss lessons learned from following Sandi Metz' rules on a project and the overall impact of rules on code.
Few days ago I've released a satellite gem for image_optim called image_optim_pack. It contains latest versions of nearly all binaries required by image_optim for Mac OS X and Linux platforms (e.g. works on Heroku). It should make optimizing images from terminal, ruby project or Ruby on Rails application even easier.
Tropical Ruby 2015, the beach Ruby conference, will take place during March 5–8th at Porto de Galinhas, a paradisiac beach located in the Brazilian northeast coast.

Avdi Grimm and Nick Sutterer are confirmed keynotes but the CFP is still open. If you want to give a talk or workshop, submit your proposal until December 7th.

Enjoy amazing conversations, stunning landscapes and a superb nature. Come and talk with some of the best Rubyists in this tropical conference.
Check out the second part of BDD on Rails with Minitest by Chris Kottom to see a step-by-step guide how you can use Minitest for complete feature implementation.
You can't expect customers to beat a path to your door because you have a great product. To succeed as a startup, you have to go out and recruit customers manually. Traction: A Startup Guide To Getting Customers gives a primer on how to market effectively. I've shared some nuggets and added some commentary as to why it matters for startups.
November 02, 2014
happy_place allows you to call js functions and pass in variables and partials. It has a simple interface which allows you to write object oriented javascript and use these objects in your controllers.

Here is an example posts controller setup that will respond to html and js. When format is js it will call the coffee script class with the index function passing in a partial with the html that you want to replace.

class PostsController
 def index
  @posts = Posts.all

  respond_to do |format|
    format.js { js partials: {posts: "posts"} }

You can put the following code anywhere but this is where I would put it

# app/assets/controllers/
class this.PostsController
  constructor: ->

  @index: (args) ->

No need for a js view!
Hello rubyists from all over the globe!
Just wanted to share with you our experience on delivering a big Rails 2 to 3 upgrade using a Canary Release approach.

I hope you guys enjoy the reading and feel free to ask any questions. Any feedback is much appreciated!
Green Ruby News #91
Another list of curated links about ruby, rails, webdev and other in Green Ruby News #91.
November 01, 2014
I've released tty-progressbar that displays progress bars in terminal and is super flexible. It is one of the components that is part of tty suite of tools. Please give it a try and let me know what you think!
In this article I discuss why and how to do virtualization in (Ruby) development. Both - Vagrant and Docker are used for initial setup. Provision is done by the separate gem - linux_provision (similar to Oracle Instant Client Provision and OSX Provision).
TheDataRoleBlockRails is a mix of 2 popular frontend solutions ai/evil-blocks and kossnocorp/role with few patches for SLIM and HAML.
Ruby is about to get red hot. Again.
Release notes here.

Notable additions:

- keyword arguments
- beginnings of Rubinius::Console
- Rubinius::Metrics

Please test your code and let us know if you see any issues. Thanks!
October 31, 2014
Memoization is an optimization technique where you cache the results of expensive method calls. When the method is called with the same set of arguments, the cached result is returned. In this post, we will look at how we can implement memoization using Ruby's metaprogramming features. [Continue reading...]
Anonymous functions and closures are a useful concepts included in most modern programming languages. Back to Basics: Anonymous Functions and Closures goes into depth in Ruby and JavaScript on this concept.
October 30, 2014
RSpec gives you a number of ways of setting up prior to test runs, but only some of these have direct analogs in Minitest. In this post, I show you the code that will let you approximate RSpec's features (and explain when and why you might want to avoid using it).
Not a fan of RVM or rbenv for installing Ruby on your production/development servers? Ruby 1.9.2, 1.9.3, 2.0.0, 2.1.x for Debian, Ubuntu, CentOS, RHEL, Fedora is now just a download away.