RubyFlow : The Ruby Community Blog

Home   Submit   Sign Up   Log In   leaders   Twitter   RSS Feed  
July 04, 2014
Kata 1.6.1 Released
Do you practice your ruby coding skills? Have you heard about code katas before? This popular gem has helped many improve their coding skills by solving the pain points around making code katas a regular habit. The new addition is that it now also supports Node and PHP. Have a look at the wiki for complete information on what the gem provides and how to use it to improve your ruby programming skills. Also check out the companion code katas project if you want to contribute.
July 03, 2014
Lita::Ext is an opinionated collection of Lita extensions to make organizing and developing your chat bot easier. Check out the full announcement for details!
In a Ruby on Rails project, all migration files generate into the same directory db/migrate. It's enough for simple projects, but not that good for large modulized projects. It is inconvenient to review thousands of files in the same directory for one project.

Since MVC directories are modular, the migration directory should the same. It's expected to be structured and clear. That's the reason I release the gem modular_migration. Just include it in your Gemfile and using Rails generator as usual.

Source code and issue tracking: Welcome to star, fork and pull request at GitHub.
To most Rails developers, just starting or otherwise, the Asset Pipeline is like the magical warp pipe in a certain 8-bit – and its many incarnations – video game most of us grew up with.

And maybe it IS that magical warp pipe that takes us to a whole new world. That’s pretty much what the asset pipeline does. It takes us to a different, and more efficient, world.

If you’re anything like me, you’ll want the TL,DR first. Think of it as finding that one awesome pipe and warping to the last level. Continue Reading...
July 02, 2014
We show you how you can build a custom query using AREL in this video tutorial.
Fun fact: rails just swallows exceptions in after_commit hooks, never to be seen again ...
fix it via gem or monkeypatch
Method visibility in ruby
Want to know about method visibility works in ruby (private public protected), some interesting corner cases and ruby 2.1 related updates? Then read this blog post :)
In case you want to add fulltext (mysql/postgres) query support to your models and you don't want to install additional search engine servers, check out attr_searchable:

Please find a few examples of query string queries:"Joanne Rowling Harry Potter")"author: Rowling title:'Harry Potter'")"price > 10 AND price
I wrote a blog post about how to bring in Ruby gems or Rails source code together with your app to do some debugging. Digging into source code really shouldn't be difficult.. Check it out here!

How to Debug Rails with Your App
A simple strategy to detect spikes in Tweets and how to create a bell that rings at each goal using Raspberry Pi.
Check it out
July 01, 2014
Last week, I wrote about methods with consistent return values, and how they'll make your code simpler. But how does that happen? Why does the right refactoring make your code easier to work with? What makes good abstraction good, and bad abstraction bad? I mean, you can’t just blindly rearrange your code and end up with quality software. If you can learn why these techniques work, you’ll be better able to understand where your code needs help. And you’ll be able to use the right tools where they matter the most.
I've created step by step guide to creating digital clock in Ruby Shoes.
Ruby blocks precedence
Carlos Antonio talks about the precedence difference between the curly braces {...} and the do...end Ruby's blocks notations, and how that subject even generated an issue in Rails issues tracker.

Read the full blog post here.
Everyone has their goto list of gems when they start a new project. Here's a look at my standard Gemfile for new projects
I just released mandriller 0.1.0. It's a simple gem for Mandrill SMTP API integration. Just replace ActionMailer::Base to Mandriller::Base, then put some lines for settings!
June 30, 2014
Just released rufus-lua 1.1.1, a Ruby - Lua (5.1.x) bridge. This release includes work and ideas from Matthew Nielsen and Nathanael Jones, many thanks to them.
Following a progressive path when developing gems and following semantic versioning results in fast-growing major version numbers. With two examples I explain my dilemma and open the discussion for proper versioning of Ruby gems.
Short (15 minutes) video demonstrating the awesome mutation tester Mutant.

I recorded it without a script, which is interesting as you see me stumble for a bit before discovering I actually had some redundant code, which is one of the cool things that Mutant will do for you.

Go watch the screencast!
In the previous episode we looked at CALayer and how easy it makes animating your views. We're going to expand on this by looking at a class I mentioned at the end of that episode called AVPlayerLayer, and it's buddy AVPlayer. Using these classes you can creating custom designed video players and animate them in the same ways that you can animate CALayer (because AVPlayerLayer is a subclass of CALayer), without making the video jump, it's all very smooth.
June 29, 2014
ITTIA DB SQL is selected as an "Editor's Choice Award" by the respected Embedded Computing Design magazine. ITTIA DB SQL continues "targeting embedded systems, mobile devices, and other Internet of Things (IoT) appliances that require non-stop access to data", allowing manufacturers to benefit from relational model and SQL to build fast, scalable, reliable and highly available applications.
A small blog post on how to test Sinatra application methods, without having to perform full requests. More isolation easier. Testing Sinatra application methods in isolation with RSpec
We show you some eager loading techniques in this ~ 13 minute video.
I've just developed this gem called Active Admin Jcrop that adds an image cropping functionality to Active Admin. I guess it's really useful in many projects.



Hope you like it and please feel free to contribute :D

Hello, I've put together another command line tool for the World Cup 2014 in Brazil that lets you query the football.db HTTP JSON API and prints today's matches. For example, typing on Jun/29 $ ojogo will print
Netherlands (NED) vs Mexico (MEX)
Costa Rica (CRC) vs Greece (GRE)
That's it. More info. Cheers.
If you are looking for a gem which allows you to define attributes in your model and you care about performance, please check out fast_attributes.

You can also look at performance comparison benchmark with other popular gems like virtus and attrio.
June 28, 2014
Test multiple rubies and gemfiles locally without Appraisal
I just launched DuckPond version 1.2 - it's either a good idea or a horrible idea, I haven't quite made my mind up yet! I also recorded a screencast which gives a quick run through of the functionality the gem provides.
June 27, 2014
Today I've released the first release of Pushr. Use Pushr to send push notifications using Redis to Android or iOS devices from Ruby or Rails applications. It's fast and lightweight!
It is often useful to know how many records are associated with a model identified as being the parent in a belongs_to relationship. Active Record's default behavior is to determine this number using a COUNT(*) query. Fortunately, you can avoid this additional costly query by caching the associated record account with a few simple modifications to your Rails application. Read the tutorial.
A quick tutorial for building a rails API as an engine. Rails API as an Engine.
The Vibe is back! After many weeks wandering lost in the wilderness, I present to you the new and improved (caveat: exactly the same) vibe. The weekly load down on what's cool in the dev and tech world. Get a sense for what the vibe is....
We upgraded a Rails 3 application to use Rails 4, and found that certain pages weren’t being updated as we expected. The problem was that cached fragments were no longer being expired properly. So we've written this blog post: If you explicitly expire cached fragments, opt out of cache digests.
June 26, 2014
Authorisation is always an issue, have to be dealt carefully and often you start off with simple home made statements like user.admin?, etc. ... I had to switch from a custom solution to a solid community proofed and backed solution. Find here my synopsis on testing Pundit with Rspec.
Some thoughts about best practices for ActiveRecord Callbacks.
Even though our logging system is considered to be a core piece of our hosting platform and even though we have very strict internal demands for keeping the system available and healthy, we still don't have to do much to keep Elasticsearch up and running. While it's incredibly configurable, we found that we haven't had to deviate much from their sane defaults. So, given the ease of use of Elasticsearch, I found myself talking more about what it's like to manage a lot of logs from a lot of sources, both software and hardware. Here are my slides if you'd like to follow along: Read more here.
June 25, 2014
Learning Ruby & Ruby on Rails
Article about learning Ruby & Ruby on Rails.
Simple Ways to Protect an API
Let's explore HTTP Basic Authentication and HTTP Token Authentication as simple solutions to protect an API from unauthorized access with examples in Ruby/Rails.
We show you in a ~10 minute video how to do associations count without resorting to counter caches.
Henry Poydar has written the worldcup-2014 gem that provides command line access to World Cup 2014 information and results.
I wrote a new post on Managing Login Passwords for Capybara with Minitest and Rails Fixtures. Hope you enjoy!
Working with Rails for some time you start nitpicking on how to improve it. This is a first in the series of articles regarding on how to improve (even marginally) Rails's performance.
June 24, 2014
Your current_user method returns a User, except when there is no user and it returns nil. A search method returns an Array of results, unless there’s only one result, and it returns just that result instead. Seems reasonable, right? Maybe even convenient! But soon, these decisions will bury your code under a mountain of if statements. There is a way to prevent this, though, and all it takes is a little thoughtfulness.
Austin is our home and it's at the heart of how we live and write software. Known for it's eclectic attitude, the city maintains the unofficial motto: "Keep Austin Weird'. The people are friendly, accepting of artistic and individual expression, lending the city a vibrant and progressive energy. We believe that as developers we grow stronger through play and exploration of our craft. In Austin, this belief is strengthened and supported as we see companies care as much about personal growth as their bottom lines. We wanted to throw a conference that feels like Austin, while taking the opportunity to show off what it is that makes our city great. We present to you Keep Ruby Weird
Take a look at one of the more popular facets of metaprogramming today, calling and receiving methods using send and method_missing.

We'll wrap it up with a neat example that implements a jQuery like collection in just a few lines of code.
I wrote short introduction to Lit - mountable as engine web interface for your translations. Lit is of course open sourced on GitHub - new features are more than welcome.
Inspired a by Stack Overflow thread, I discuss helping yourself by avoiding test case clutter.
June 23, 2014
In this ~8 minute episode we introduce you to the N+1 Problem.
Introducing Lotus
Lotus is a complete web framework for Ruby with a strong emphasis on object oriented design and testability. If you use it, you employ less DSLs and more objects, zero monkey-patching, separation of concerns between MVC layers. Each library is designed to be small, fast and testable.

read the announcement
I just released rack-secure-upload. You can reject malicious files uploaded by user!
Working with UIKit and AppKit is common place when you're working with RubyMotion, but sometimes it's good to drop down a layer (or should I say CALayer), and interact with something else. CALayer is a great class to work with, especially when it comes to animating properties, because it does it all automatically for you. Watch this episode and see how to take advantage of this awesome class.