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.
TDD’ing a Ruby refactor: “Module Extraction”
A simple example of how you can extract some logic from a model into a module that is reusable..
Aggresive caching with nginx and the Rails asset pipeline
In this post, I explain how to cache your Rails assets properly using nginx. This is one of the easiest and most effective performance optimizations you can make for you app, and can reduce page load times by seconds(!) on high latency connections.
New gem: rack-allow-from - white listed hosts can connect to your app
I just launched rack-allow-from, white listed host controls. Add hosts, like config.allow_from += ["1.2.3.4", "8.8.8.*", "example.com", "*.example.com"] to your application.rb. One caveat, using hostnames requires the client send the header X-Remote-Hostname (see the docs). Everyone else gets 403 unauthorized access… Tests and some docs to boot.
Go-powered web-services with Rails
Hey folks, my new blog post about Go-powered web-services with Rails is out. Enjoy!
Transaction isolation with ActiveRecord
I just launched transaction_isolation gem. It allows you to set transaction isolation level in a database agnostic way. Read more
Faye 0.8: new WebSocket and Redis libraries, and performance improvements
I just shipped version 0.8 of Faye, the pub/sub messaging toolkit for the Web. It splits the WebSocket support and Redis backend into new libraries, and makes it possible for 3rd parties to implement their own pluggable backends. Everything you need to know is on the blog.
Strict Validations in ActiveModel
Rails v3.2 has added the concept of strict validations. I briefly explain how they work and how to configure them.
Command Line Reporter 3.2 Released
The latest version of Command Line Reporter now supports unicode drawing characters for better looking output if your ruby version supports unicode. Check out the wiki to see examples of nicely formatted tables. As always The gem is available on rubygems.org with source on github. For those not familiar with “the reporter”, it provides a ruby DSL for writing reports with built in features for progress reporting and table formatting. It is very handy for system level and data reporting scripts.
How to extend the Redcarpet 2 Markdown library?
Redcarpet is a nice lib for parsing Markdown and rendering HTML (or other formats) from it. I explained how to extend it to generate an HTML tailored for your special needs.
Mutation testing with Mutant
I just released a new version of Mutant, a mutation tester for Rubinius, and blogged about it.
Command line Pow wrapper
I just launched pow-client, a simple command line wrapper for simplifying Pow workflows.
RailsApps starter app with Devise "Confirmable" and "Invitable"
Not such a big thing, but the rails3-devise-rspec-cucumber example app is popular and now it offers an option for including the Devise “Confirmable” and “Invitable” modules when you use the application template to create a starter app. Devise once included the “Confirmable” module by default; since it was removed there have been questions about how to set it up. The starter app does it for you and includes Cucumber tests as a bonus. It’s all in an update to the rails_apps_composer gem that I use to build the application templates.
Yahoo Placemaker
I just launched yahoo-placemaker which is a gem that simplifies the process of interacting w/ the Yahoo Placemaker API so you don’t have to!
Documentation: ARel with ActiveRecord
I really like ARel, but I find its lack of documentation an unreasonably high barrier to using it… And since no one I work with was willing to read their code and tests, to figure out how to use it, I wrote a coupla things about it. For a nice cutsey scenario see this post or for a simple reference see this slideshare.
Add some spell check to your view tests
I just created merimee, a gem that gives you some nice macros to add automatic spell checking to your view specs… Make your specs red if there’s a spelling error in your views ! Full tutorial available there.
AJAX Pagination - The easy way to add AJAX to site navigation
I just launched AJAX Pagination. It is specifically designed to make it easy to add AJAX functionality to your site, so that when navigating pages with AJAX, only the specific content will reload. It is so easy to use, you don’t have to touch a single line of javascript. Read more
Restivus - REST APIs for the rest of us
I just launched Restivus. It helps you expose CSV data as a REST API, with a self-generating docs page that has example requests and responses that actually work.
Muse - A Ruby DSL for making music
Muse is a Ruby DSL for creating music. Unlike MIDI, Muse scores actually create WAV files and are also executable Ruby scripts to boot. You can write your own songs or dynamically create them based on input data, embed Muse within other applications and generally have lots of fun with it!
Custom RSpec matchers for blocks, and the Ruby magic behind their inner workings
In RSpec it is possible to define special custom matchers that enable us to test, with a neat syntax, what happens when some code is executed, while also helping reduce duplication. Read more
Autosmusher gem for Paperclip
Hi you all, I’ve just published paperclip-smusher gem. It is useful to compress JPEG and PNG images during paperclip image upload process. I hope you like it, and feel free to contibute!
Rails and CanCan: Authorization for Specific Fields
Over on the Highgroove blog, I posted about Rails and CanCan: Authorization for Specific Fields.
Active Record without inheritance
ActiveRecordComposition is a gem that allows you to easily use ActiveRecord without inheritance of ActiveRecord::Base. It dynamically creates an aggregate that holds the association for you and delegates your interactions with ActiveRecord to the delegate. Come check it out! Read more
Tuning Apache and Passenger
Ever wonder how to measure and tune your application’s performance? In Performance Tuning Apache and Passenger, I show how we used httperf, htop, iftop, and a handful of other tools to measure, tune, and identify performance hotspots in your application. While this deals a lot with Rails, Apache, and Passenger, what I cover about the use of the tools apply to any http server-side process.
rails_best_practices 1.8.0 released
I just released rails_best_practices 1.8.0, it adds not use time_ago_in_words check, provides better foreign key and routes analyzer, etc., check out the changelogs here
Quick dive into Ruby ORM object initialization
If you ever wondered what’s going on when you initialize an ActiveRecord model, and if you aren’t scared of pretty graphs, then checkout my latest blog post on this topic.