RubyFlow : The Ruby Community Blog

Home   Submit   Sign Up   Log In   leaders   Twitter   RSS Feed  

jim — 53 posts

Ruby Forwardable deep dive
Take a deep dive into Ruby's Forwardable library and find out how it works. I learned so much by getting familiar with this simple library so I decided to pull it apart piece by piece in my latest blog post.
I created some short code to solve a problem but my quick thinking hid a bug from me. My recent post is about how, by being just a bit more verbose, I got my code to work properly.
I recently wrote about how to ensure that your objects have the right responsibilities and enforce a Tell, Don't Ask approach.
I recently wrote a post where I show some code displaying the contrast between using value objects and setter methods.
Continuing my articles about forwarding and object responsibilities, I just released a new post about the benefits of managing change using a common interface.
I wrote about how sending a message as a command leads to flexibility in Forwarding Messages With Tell, Don't Ask.
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 wrote a new post about forwarding messages to an object that might be nil and what to do with your code.
I'm an avid user of Forwardable from Ruby's standard library. My latest article explains why you can make shorter, simpler code with Forwardable and hide the noise of boilerplate Ruby code.
Dennis Monsewicz wrote about the power of more readable specs using context blocks with RSpec over at his blog. Check it out.
I wrote about understanding and knowing when to use tools like SimpleDelegator and Forwardable, tools readily available without needing any bundle install.
A while ago I researched and wrote about the meaning of "delegation" in programming. Most commonly, developers think this means just forwarding a message to another object, but I wrote to both Henry Lieberman (who coined the term) and Lynn Stein to get a better understanding from these pioneers of OO. I wrote about that on my website and created the casting gem from the idea too.
Programming is an ebb and flow of making decisions about what's important and what's not. I wrote about how our brains react to what we see and how abstractions can work with our brains.
Read about how to manage choosing which data to display from various objects and how to create your own dynamically defined methods over at my blog.
Continuing my series on managing presenters and views I wrote What to code when you know what you want.
Continuing my series on managing display logic, I wrote How to make your code imply responsibilities.
I just posted Formatting collections of objects with SimpleDelegator on my site. Let me know what you think.
I just wrote a post about automating repeated ideas and displaying potentially dangerous data on my blog.
I recently wrote about fixing a display bug to handle bad data at
Read about it at
Read through this post on the Medium blog about a security vulnerability dubbed "BREACH" and check out the breach-mitigation-rails gem that attempts to help protect against it.
The ability to add behavior to an object for a short time can make for some very flexible structures. Casting is a new gem that allows you to run methods from a module at runtime without altering the object's superclass structure (for example, no need for #extend).
Ruby delegate.rb secrets
You may see quite a few uses for SimpleDelegator but the delegate library has a lot more to it than just helping you manage method_missing. Read more about it at Ruby delegate.rb secrets
Search through bundled gems
Find something inside your bundled gems with ag whatyouwant `bundle show --paths`

You can use ack or grep if you like. I wrote a bit about searching through your bundled gems on my blog.
Read about how ActiveSupport::Concern won't reveal how your system works or why any of those concerns exist where they do. DCI is an approach to help you capture how objects collaborate and not just separate methods into modules.
Getting programming concepts wrong leads to problems understanding them, of course. The Gang of Four cited the original work on delegation and explained it incorrectly because their language couldn't do it. Get delegation right. Ruby doesn't.
Noah Gibbs recently wrote about understanding parameter parsing in How Does Rack Parse Query Params? With parse_nested_query.
Why Is My Web Service API Crappy?
Christopher Miles has a great article: Why Is My Web Service API Crappy? and it's definitely worth a read if you're building externally facing APIs.
Wroclove.rb Links
There were some great presentations at wroclove.rb and Michał Kwiatkowski is gathering a list of all the things you missed.
Triggering the DCI Context
In continuing the discussion of DCI, I've written a bit about what purpose the Context serves. It's not just a new junk drawer to use extend with objects and modules.
Arlington Ruby is a group that's less than a year old but we're growing strong and putting together our first unconference. This is a FREE event, just contact us for a coupon code:
Radiant is alive again with release candidate 4 for version 1.0. And you can now run tests for your extensions on travis ci.
Read more about why you might care about DCI (Data, Context, and Interaction — a new approach to object oriented code) in my latest post on the subject. OOP, DCI And Ruby - What Your System Is Vs. What Your System Does discusses separation of objects from the actions they perform.
I've been exploring DCI in relationship to Rails and wrote about some very simple steps to move toward a more object oriented way of thinking. This isn't a full example of DCI, but it's a start.
gem install radiant --pre and try out the RC2.

Thank you everyone who helped report and fix bugs.
We've just released the first release candidate for Radiant 1.0; the last Rails 2 version.

gem install radiant --pre
Always check in schema.rb
Some argue that schema.rb should be ignored in your version control. Long story short, I argue that it should not.
I recently added a new feature to Radiant to allow users to manage their own CSS and Javascript content. Read about the change and the Radiant blog and leave your complaints or praise in the comments.
I wrote about some simple metaprogramming in Radiant to solve an annoying problem of not being able to use custom tags in different contexts. Radiant includes custom tags in the Page model, and a popular option for managing stylesheets and javascripts prevents you from using these same custom tags in them. A few simple lines changes that.
Radiant CMS 0.9 is out
I'm happy to say that Radiant CMS 0.9 has been released. It's got internationalization, pagination tags, loads extensions as gems, and lots of other fixes and features.
I wrote down some details about using the memcached heroku add-on with rack-cache. It wasn't obvious to me at first.
I've written up some details about how Radiant manages finding content and how you can override that behavior for your own needs. There's a quick summary at the top of the post if you're in a hurry.
I put together a simple plugin called show_for_stonewall and just put a quick blog post about using it.

It simply alters show_for to allow for the guarding of data that stonewall provides.
There's a quick post about it on the Radiant blog.
We've released RC2 of Radiant 0.9.0 and have some details about it on the Radiant blog. The big news is support for internationalization in the admin interface, support for extensions as gems, and other features.
I've created the enabler extension to allow you to enable and disable a Radiant site remotely.

Just install it and when your customer's account is in default, post to Once your customer has paid her bills, just post to

Let me know what you think.
using git bisect
I just found a short article on using git bisect.
I've posted 2 articles about Radiant CMS integration with Rails projects and loading plugins.

Feedback welcome! Radiant seems to be both popular and unpopular for different reasons and I'm hoping that each release makes it easier to use with the code you write.
I have a quick post about the radiant comments extension as a gem. Read a bit about it and some more details in the comments.
Quick mention of a simple feature to store config data in your source for Radiant CMS.
In new developments with Radiant CMS, Sean Cribbs is stepping down as the team lead (although still an active member of the core) and, Jim Gay is taking the reins and William Ross has been added to the Core Team.
I often have websites that need to have similar functionality. Here I discuss a simple way to manage standard and custom extensions between different sites.
I've been working to add caching to an application and looked around for a solution to use a cache_key for lists of objects and found nothing out there. I've written up some details about adding a cache_key method for activerecord collections and I've thrown it into a simple group_cache_key gem