The Ruby and Rails community linklog
Made a library? Written a blog post? Found a useful tutorial? Share it with the Ruby community here or just enjoy what everyone else has found!
Submit a post
Post Preview
Note: Only the first pargraph is shown on the front page and overly long paragraphs may be broken up.
Refactor to concepts
Anyone can write hard to understand code but think about helping your future self by making your code cleaner and more readable. Follow this simple step-by-step refactoring and then you can use the same strategy to make your code more understandable.
How Arel Converts Ruby Queries Into SQL Statements
Pat Shaughnessy shows how Active Record uses the Arel gem to convert the ActiveRecord::Relation object describing your query into a string containing a SQL statement. [more inside]
Conway's Game of Life.
This is a Rails implementation of “Conway’s Game of Life.” [more inside]
How good are your Ruby tests? Testing your tests with mutant
We write tests to avoid regression bugs. If that’s so important then do we test our tests? What is test coverage exactly? Is line coverage of any use? How does mutation testing fit here? I’m trying to answer those questions in my last blog post: [more inside]
Painlessly import themes into you Rails app
I just finished writing the first version of my new gem theme_importer_rails which allows you to import a bootstrap theme (or any kind of theme) into your Ruby on Rails application with one command. Please try it out and leave feedback. PRs are welcome as well!
Volt 0.9.3 Released with Support for Clustering, Simplified Persistence and Improved
The volt framework is progressing quickly as we move towards 1.0. We cover all of the changes in our latest blog post.
Decoupling CSS Selectors From Your Tests
For a long time, I’ve been bothered by the problem of using CSS selectors to target DOM elements in my tests (with Capybara). In this short article, I’m going to try Eduardo Gutierrez’s suggestion of using data attributes for targeting DOM elements instead of CSS selectors. Check it out
Refactoring to Reveal Rails Group_by
Refactoring is a humbling process – especially when you write a 10-line method only to discover that it already exists! This blog post refactors some bad code to reveal the Rails group_by method in all its glory.
How to Deal With and Eliminate Flaky Tests
Randomly failing tests are the hardest to debug. Here’s a system you can use to fix them and keep your test suite healthy. Read it here!
The Rational Command-Line Parser
$ ruby example/parse.rb -x 3 -y 4 -n5 -abc --beep=boop foo bar baz # =>
{ :_=>["foo", "bar", "baz"],
:x=>3,
:y=>4,
:n=>5,
:a=>true,
:b=>true,
:c=>true,
:beep=>"boop" }
Hitting real Angular http service from Jasmine test
Simple example about how to create tests for real services in Jasmine tests.
Cells 4.0 – Goodbye Rails! Hello Ruby!
Cells 4 got released. This version is completely decoupled from Rails, and allows view components in any Ruby environment. Read the release post and why it still allows to use Rails view helpers, why it’s faster than ActionView and where we’re going from here.
Design is Refactoring: Replace array with object
Refactoring, primitive obsession and method parameters. This week it’s time to look refactoring away Arrays and Hashes
Object Oriented Design Basics
How to apply Open Closed Principle to FizzBuzz and eliminate if-else-elsif statements.
Using Struct and OpenStruct
Sometimes you just want an object that can store some data for you, the struct class is very useful in this situation.
Awesome Ruby Events - Summer Update (Incl. Italy, Vietnam, Colombia, etc.)
Hello, I’ve updated the Awesome Ruby Events list that collects Ruby events (meetups, conferences, camps, etc.) from around the world. New entries include: Ruby Vietnam, RubyDay Italy, ROSSConf Berlin, RubyConf Colombia and more. Full list. Anything missing? Contributions welcome. Cheers.
RubyDay 2015, the Italian Ruby conference
On November 13th, 2015 the RubyDay will be held in Turin. It’s the only Ruby conference held in Italy and it’ll be a great place to meet other developers and companies, learn some new tricks and have fun altogether. If you feel like having a talk the Call for Papers is still open!
React and CoffeeScript (cjsx) on Middleman
React and Middleman are not a common pair, but when working entirely on the front-end and digesting a Rails API, it’s really advantageous to stick with a stack you already know. The only viable alternatives are vanilla everything or a js stack. This tutorial will get you up and running so that you can use React with CoffeeScript compiled by middleman and deployed on heroku.
Ruby-asterisk - Asterisk Manager Interface in Ruby
A few years ago I wrote a library to interface a ruby application with asterisk, its name is ruby-asterisk (original huh?). I wrote a post to introduce it, hope you enjoy it!
Gradual engagement with Rails
When a visitor reaches your website, you might want to allow them to use some of the functionality of your app without creating an account. This UX technique is called gradual engagement. In this post, we will walk through adding lazy registration to a simple app.
Only $584 away from bringing ten new contributors to Practicing Ruby
I’m trying to raise some money to pay Ruby community members to produce open source learning materials via Practicing Ruby. If we can rustle up just a few more backers, I can start the search for contributors as early as today. [more inside]
PStore: Ruby's Lesser Known Key/Value Store
I wrote a blog about “PStore”, a feature of Ruby that I feel doesn’t get enough attention despite its usefulness.
Demystifying @tenderlove's homeopathic code optimizations
At the Keep Ruby Weird conference, Aaron Patterson gave a hilarious keynote talk where he talked about homeopathic code optimizations. Read on to find out how that impossible piece of code worked:
Debugging Memory Leaks on Heroku
I recently ran into a problem that looked like a memory leak on Heroku, it took some time to explore and find the root cause of the issue. For a spelunk on debugging memory leaks on heroku: