RubyFlow : The Ruby Community Blog

Home   Submit   Sign Up   Log In   leaders   Twitter   RSS Feed  
 
June 25, 2014
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  lotusrb.org
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.

https://motioninmotion.tv/screencasts/32
Eileen Uchitelle, a Lead Developer at Phishme, gave a very interesting and informative talk at Ruby Nation this past weekend. The talk focused on how problems can arise when developers make the assumption that Active Record knows best instead of understanding how its methods translate into MySQL.

During her presentation Eileen explored an example for each CRUD function and demonstrated how the usage of certain methods could result in MySQL timeouts, memory leaks or slow queries. Read the rest of the blog post.
I've released another version of finite_machine which sports few changes, the most notable introduction of choice pseudostate. I'm looking forward to your feedback to make this state machine awesome one!
June 22, 2014
A quick four-minute screencast about threads in Ruby. The code, the reasons to use threading, limitations, the gotchas.
We show you how to use the Array#map and Multiple Assignments to help clean up some code ~ 6 Minute Video
June 21, 2014
Few words about documentation, code quality and costs that you can have, when you don't care about stuff like this. More in my article: Ruby programmers/project managers/CEOs Y U NO enforce code quality?
June 20, 2014
Some developers have said they really want to restore the MongoDB/Mongoid option to Rails Composer. If that's you, consider joining a MongoDB Rescue Operation for Rails Composer.
As the intro states "Every RoR developer will have to modify a gem at least once in his or her career, but not everybody has actually created a gem." This handy tutorial wants to change it Creating a GEM - a step by step tutorial.
I have released formnestic open-source gem (Formtastic extension) for Rails that is going to help a lot on building nested model form with table form style, adding/removing ability, etc.. Check it out! You can also grab the source code on Github if you wish to.
Variants with Ruby on Rails  reinteractive.net
We explain a new feature in Rails 4.1: Action Pack variants.
We have updated all environments to Bundler 1.6.3.

What does this mean to you?

Faster deployments. As part of 1.6, they have rewritten the resolver to avoid recursion. The bundler team is reporting up to 10x performance improvements when resolving Gemfiles. Learn more here.
June 19, 2014
Hacking Minitest output for fun and profit:
http://chriskottom.com/blog/2014/06/dress-up-your-minitest-output/
June 18, 2014
We show you how to setup ruby for development on OSX in a ~ 5 minute video.
i18n-tasks v0.4.5 has just been released. The gem helps you find and manage missing and unused translations. It has gone a long way since the first release in Oct 2013, and supports a number of features that can save you lots of time:

* find missing and unused keys
* fill in missing keys with Google Translate or base value / placeholder
* find key usages
* manage key structure across files

I would love to hear how you are using i18n-tasks!
Don't manually setup your new laptop with a series of copy-and-pasted steps from some blog post. Leverage automation and the open source community to save time and get a more stable result.
I've just released a tutorial on Rails authorization with Pundit. I appreciate the support I'm getting from subscribers to the RailsApps project that makes it possible to write these tutorials.
A new version of the elasticsearch-persistence Rubygem has been released, with support for using Elasticsearch as a persistence layer for Ruby/Rails models. See all the info at Github, and use the Rails template to generate a full example application.
In case you weren’t aware, we at Kickstart Academy have got Sandi Metz coming to London to teach her Practical Object-Oriented Design classes.

You should be there because:

* Sandi has lots of Smalltalk and Ruby development expereience
* She’s one of the most experienced and best object thinkers we know
* She’s an amazing teacher

Check out the podcast we recorded last month for a taster.

We're really excited about this course, which is the first time it has run in the UK. There are two options: a 3-day from 25-27 June and a 2-day from 3-4 July.
I've just written a blog post about some odd things I found out while playing with irb about custom setter methods.
June 17, 2014
The last of our two regular ticket sales takes place tomorrow, Wednesday 18 May at 10am CEST. Tickets are available at tickets.eurucamp.org and, once again, expected to sell extremely fast! What's more, our full speaker line-up has now been announced!
Foolproof I18n Setup in Rails  robots.thoughtbot.com
Let’s make I18n on Rails better, quickly and easily. These tips have helped us and caught some easy-to-fix but hard-to-track-down mistakes.
How Rails' Type Casting Works  robots.thoughtbot.com
Have you ever noticed that when you assign a property to an Active Record model and read it back, the value isn’t always the same?

This is because Active Record automatically type casts all input so that it matches the database schema. Depending on the type, this may be incredibly simple, or extremely complex.

Let’s take a look into how the internals work in 4.1.
After you build a few Rails apps, you'll begin to have some preferred ways of working with them. Maybe you always want to use awesome_print in your Rails consoles. Or you might want rails new to create projects that use rspec instead of minitest. Sure, it's only a little annoying to have to specify these preferences each time you run a command. But they're easy to forget. With a few small tweaks, you can have these commands remember your preferences, so you won't have to.
Grab this free re-usable snippet to integrate Deployment Tracking with Rollbar into your Deployment Process.

Tracking Deployments with Rollbar – Free Snippet
Tired of specifying eager loads in your Rails application? We wrote a post exploring how Rails could handle eager loads automatically and we released a corresponding gem to demonstrate these ideas.
I just released a new gem called stack_rescue that automatically searches Google for exceptions raised in your Rails applications. Check it out on Github.
Want to do some more metaprogramming? Heck yes you do!

Come along and learn how to monkey with Ruby's methods. We'll introspect on methods, build a method decorator, and learn a neat syntax trick.

It's going to be great.
Last Sunday the Stories of Change - a showcase presenting 29 unique stories of daily life in North Africa that changed after the "Arab Spring" events - has been launched. We're super happy to be part of this project lead by World Press Photo. As a team responsible for the entire back-end site (Ruby on Rails of course!) - we'd love to share with you our story - Behind The Scenes: Announcing Stories of Change for World Press Photo.
Tonight at SydInMotion I got in a discussion that lead to me explain Dispatch.once and why it’s so handy. I’ve decided to write this up as a quick tip as it’s useful in almost any application.

http://blog.motioninmotion.tv/grand-central-dispatch-isn-t-just-for-background-queues
another way to do metaprogramming that has some advantages over the traditional approach
June 16, 2014
Hello, The latest sportdb gem includes new tables (and models) for group, league and all-time standings. For example, to calculate the all-time standings table for the World Cup (including all nineteen tournaments from 1930 to 2010) use the football.db build script and issue $ rake build DATA=history This will import all teams, tournaments, results, and so on and dump
the all-time standing e.g.
1 Brazil (BRA) 97 67 15 15 210:88 216 19
2 Germany (GER) 99 60 19 20 206:117 199 17
3 Italy (ITA) 80 44 21 15 126:74 153 17 ...
The full results all serve as a great checksum that all football.db match data is up-to-date and complete. Cheers.
I just published The definitive guide to Arel, the SQL manager for Ruby. Enjoy!
I am a very beginner with ruby but not in programming. Want to learn this language very well. I heard ruby community is awesome! So, can I work with any experts group, from whom I can learn this amazing language? Is there any mentor at rubyflow?
I just released rack-dev-mark 0.3.0. The github-like dev ribbon will be shown on all the pages in development environments!
Practical Microservices with Ruby book  practicalmicroservices.com
I'm writing a book on practical microservices with Ruby. If you want to stay posted on my progress, receive book excerpts and get a special launch discount, subscribe here!
My step by step guide to creating post-it notes app in Ruby Shoes with YAML::Store for storage of notes.
After popular request, here is a basics episode for using MotionKit with your table cells, including how to use autoresizing masks and the MotionKit DSL for Auto Layout in your table cells. A short episode filled with good tips.

https://motioninmotion.tv/screencasts/31
June 15, 2014
We introduce you to the Message Verifier feature in Rails 4.1 ~ 11 Minutes video