#294 Playing with PJAX

This post is by Ryan Bates from RailsCasts

Click here to view on the original site: Original Post

PJAX allows you to quickly update a section of a page using AJAX with automatic pushState support. Here I show how to use both pjax_rails and rack-pjax gems.

This Week’s Top Ruby News: JRuby 1.6.5, A New Prag Prog Book, Fast Specs, Rails Style Guide and More

This post is by Peter Cooper from Ruby Inside

Click here to view on the original site: Original Post

This week brings us a new JRuby release, some Ruby 2.0 news (but you knew that already, right? ;-)) and a new BDD library that seems to have struck a chord with the people I’m following on Twitter. Also, my Ruby Reloaded course is now also over half booked out so if you’re curious, definitely check it out now.

Without further ado, here’s a round up of the top Ruby news and releases from the last week, courtesy of Ruby Weekly:

Headlines and Releases

JRuby 1.6.5 Released: Rounding out Ruby 1.9 Support
The primary goal of JRuby’s 1.6.x series is to round out the Ruby 1.9 support by fixing any reported incompatibilities. This continues with JRuby 1.6.5 and all JRuby users are encouraged to upgrade. 1.6.5 brings updates to RubyGems, fixes to 1.9 encoding and improved fiber performance.

Prag Prog Book ‘Build Awesome Command-Line Applications in Ruby’ in Beta
I haven’t checked it out yet but the Pragmatic Programmers have announced the first beta release of a book by David Copeland about building well-formed command line applications in Ruby.

@CodeWisdom: Inspirational Programming Quotes via Twitter
I’ve started a new account on Twitter called @CodeWisdom, that’s dedicated to sage programming related wisdom and quotes, as well as links to discussions on best practices and techniques. If you’re on Twitter, follow along.

Ruby 2.0 Implementation Work Begins: What is Ruby 2.0 and What’s New?
Ruby 2.0 is the next major version release of MRI Ruby, the de facto official Ruby implementation. What’s it about and what might it include? Ruby Inside takes a look.

Articles and Tutorials

Connection Management in ActiveRecord (and How To Improve It)
Aaron ‘tenderlove’ Patterson talks about database connection management in ActiveRecord, how he’s not pleased with it, and how he wants to step towards fixing it to be more like File’s API.

Fast Specs!
Continuing the popular and recent string of posts about making your test or spec runs faster, Les Hill brings us more fast speccing goodness (RSpec specific, in this case) and shares a Rails app that implements his techniques.

Rails is Not Your Application
Speaking from the Uncle Bob bible, Nicholas Henry argues that Rails applications are better structured with a ‘service layer’ to better separate key application functionality from the restrictions of a framework. He presents a good case.

A Modern Guide to Threads (in Ruby)
Mike Perham recently spoke at RubyConf 2011 on some advanced threading-related topics. In this article, he explains, from a Ruby perspective, some gotchas with threads and why he thinks you should simply try and avoid them.

The Rails Style Guide: Rails 3 Advice in a Single README
The Rails Style Guide is a Rails 3-focused style guide presented in a single README file on GitHub. It covers a lot and is rather opinionated technology wise but is an easy read and you should pick up a few tips nonetheless.

A Quick Introduction to Rack
Satish Talim of RubyLearning presents a thorough introduction to Rack, the popular library that abstracts HTTP servers and requests in most common Ruby frameworks and webapp libraries.


Generating Spine Scaffolding with Rails
A super quick introduction to integrating Rails and Spine. Want to build a Rich Internet App in less than 8 minutes? Alex MacCaw shows you how to do it with Rails and the Spine JavaScript library.

Rails 3: Beginner to Builder – An 8 Part Rails Course Shared Online
Rails 3: Beginner to Builder was a course given by Richard Schneeman at the University of Texas over eight weeks and he’s now shared the videos, slides, and other materials on his blog.

Libraries and code

Spinach: A New BDD Framework (Alternative to Cucumber)
Spinach is a new BDD framework that aims to resolve a number of perceived pain points with the popular Cucumber system. This blog post sums up the differences, pros and cons. Maybe it’s the ideal way forward for you too?

GCC Installer for OS X (Without Xcode)
Gotten sick of needing to install Xcode when setting up RVM or just compiling Ruby on a new Mac? The osx-gcc-installer project can help you skip the pain by just giving you gcc in one hit.

High Voltage! Using Rails 3.1 for Static Sites
Nick Quaranto of Thoughtbot wanted to use Rails 3.1 in deploying a static site to take advantage of Rails’ features and asset packaging. In this post, he demonstrates using the ‘High Voltage’ Rails engine to do just that.

Watch Tower: Track How Much Time You Spent at the Directory and File Level
WatchTower helps you track how much time you spend on all of your projects, at the project, directory, and file level. It’s built in Ruby and supports TextMate and Xcode on Mac OS X.

Jobs of the Week

Last but not least..

Turbocharge Your Ruby Skillset With My Online Ruby Reloaded Course
Are you an intermediate Rubyist looking to boost your Ruby skillset with things like test driven development, OO design, building libraries and learning some of the lesser known nooks and crannies of Ruby? My Ruby Reloaded course runs in November and December and is now just over half sold out. If you want to join, check out this page for more info soon and use the code “SHOW” for $80 off the usual rate.

Build Awesome Command-Line Apps; Dropbox support; JRuby Tenth Anniversary

This post is by Pragmatic Bookshelf from Pragmatic Bookshelf

Click here to view on the original site: Original Post

Build Awesome Command-Line Apps now in beta; Dropbox suppor for your eBook purchases; JRuby Tenth Anniversary

The Dodging Samurai Win the First Annual Octocat Dodgeball Invitational

This post is by Michelle from Heroku

Click here to view on the original site: Original Post

So our good friends at GitHub put together the First Annual Dodgeball Invitational with the intention of pummeling various Bay Area tech companies into submission. Heroku has never shied away from a challenge, especially when there is a giant Octocat trophy at stake. The Dodging Samurai emerged victorious despite facing a pool of 21 teams and one crotchety old man wielding a wrench.

Through brute force, covert strategies and pink tutus, the Herokai were able to persevere through two teams from both GitHub and Engine Yard, a solid team from Code for America, as well a mysterious unnamed lucha libre fighter from Twilio. We commend both the spirit and the dodginess of all our competition and look forward to next year’s event.


What’s the best part? The bulk of the entry fees will now go to our charity of choice, Heifer International. $28,500 will now be donated to empower families around the world to become self-reliant through sustainable development projects.

The Octocat trophy has found a lovely home at our lunch table. We weren’t sure if he was actually a cat in an octopus costume or a fully different species, but we bought catnip and various toys for him anyway. Check out this Quora thread about the Octocat’s proud lineage.

Ruby 2.0 Release Schedule Announced: Roll on 2013!

This post is by Peter Cooper from Ruby Inside

Click here to view on the original site: Original Post

Today, Yusuke Endoh posted to the ruby-core mailing list noting that matz has admitted him as a Ruby 2.0 “release manager” and as part of his work, he has come up with a tentative schedule for Ruby 2.0’s release. You can read the full post here.

I’ve been admitted as a 2.0 release manager by matz. I’ll do my
best. As my first work, I’d like to announce a rough plan for 2.0
release. Anyone who is interested in 2.0, especially who is thinking
about feature proposal, should check it out.

Yusuke Endoh

The short version of the timeline?

  • August 2012: ‘Big feature’ freeze. Any proposals and specs for ‘major features’ should be wrapped up for late August 2012 otherwise they will be deferred.
  • October 2012: Feature freeze. A more conventional feature freeze.
  • February 2013: 2.0 Release. The final version of 2.0 would, hopefully, be released.

A release in February 2013 would have historical significance by being the 20th anniversary of Ruby’s creation. Note that Yusuke corrected the date to February 24, 2013 in a later posting.

Another note, confirming what Yugui had already said, is that Ruby 2.0 is to be “100% compatible” with Ruby 1.9.3.

If you want to learn more about Ruby 2.0, I recommend Ruby Inside’s last post, Ruby 2.0 Implementation Work Begins: What is Ruby 2.0 and What’s New? where I summarized the anticipated new features in Ruby 2.0.

Thanks to Ruby guru Steve Klabnik for the heads up on this news. Follow him on Twitter, it’s worth it.

#292 Virtual Machines with Vagrant

This post is by Ryan Bates from RailsCasts

Click here to view on the original site: Original Post

Vagrant allows you to run your Rails application and all of its dependencies in a portable, sharable environment. Use for development, set it up as a staging server, or experiment with a production setup.

Ruby 2.0, HotCocoa, Bundler 1.1

This post is by Jason Seifer and Dan Benjamin from The Ruby Show

Click here to view on the original site: Original Post

Peter and Jason talk about the changes to Ruby 2.0, the upcoming release of Bundler, HotCocoa, and more.

Git and GitHub Revised Course

This post is by Satish Talim from RubyLearning Blog

Click here to view on the original site: Original Post

Git and GitHub Course

Registrations are now open for RubyLearning’s popular Git and GitHub course. This is an introductory but an intensive, online course for beginners. Here you’ll learn the essential features of both Git and GitHub that you’ll end up using every day.

What’s Git and GitHub?

Git is an open source version control system designed to handle very large projects with speed and efficiency, but just as well suited for small personal repositories (collection of resources that can be accessed to retrieve information); it is especially popular in the open source community. With GitHub you can host your public and private projects there and use it to collaborate on projects.

Ruby Master, Josh Susser1 in an interview with RubyLearning said:

First off, get an account on GitHub. (If you haven’t learned git yet, get going on that too – it’s the future for open source SCM.) Then do some exploring around the various projects and see where you think you can jump in and contribute something. Pick a project that is currently under development and has an active community. You’ll have enough going on that you don’t want to be championing a project just yet.

Get involved in the Ruby community. Join GitHub

What Will I Learn?

The course topics in brief are:

  • What’s Version Control
  • What’s Git
  • Downloading and Installing Git
  • Create your local repository folder
  • Create your SSH Key
  • What’s GitHub?
  • Set up your GitHub account
  • Creating a new repository
  • Deleting and renaming repositories
  • Fork a repository
  • Push changes to a repository
  • Clone a public project
  • Add collaborators to a project
  • Collaborate with other users
  • Send a pull request
  • Merge changes from a pull request
  • Watch projects and people
  • Use project wikis
  • Create and delete branches and tags
  • Create GitHub pages
  • Gist
  • Exercises

Who’s It For?

The Git and GitHub course is a starting point for people new to Git and GitHub, to learn it as quickly and easily as possible.


The course starts on 29th Oct. 2011 and runs for a week. You first need to register on the site and then enroll into the course. After registration, you can download the “Git and GitHub” eBook (a US$ 7 value) for free.

Early Bird Registration Discounts

  • For the first 5 registrations, Course Fee: US$ 7 per participant
  • After the first 5 registrations, Course Fee US$ 14 per participant

The course fee goes towards maintaining RubyLearning and helps provide quality content to you.

The first five batches were a run-away success. So hurry, registrations have started.

Technorati Tags: ,

Ruby 2.0 Implementation Work Begins: What is Ruby 2.0 and What’s New?

This post is by Peter Cooper from Ruby Inside

Click here to view on the original site: Original Post

Yesterday, Matz made a commit to the MRI Ruby repository bumping the trunk version from 1.9.4 to 2.0.0, marking the start of the work of implementing the long-discussed ideas for Ruby 2.0.

What is Ruby 2.0?

Ruby 2.0 is the next major version release of MRI Ruby, the…

Refactoring: be eager, not reckless

This post is by Josh Susser from has_many :through

Click here to view on the original site: Original Post

The illustrious Chris Eppstein recently tweeted:

If some code should be refactored, stop what you are doing and refactor it.

I was about to respond, but realized I had more to say than would fit in a tweet. (Waiting for someone to fix that problem!) (Then I got distracted and didn’t finish this article for a few days, oops.)

Now, Chris is really smart and probably doesn’t mean exactly what he said, but it’s easy to misinterpret his advice. I’ll agree with him that you should be eager to refactor code when you discover the need. Don’t let that technical debt accrue interest longer than necessary! However, you shouldn’t be reckless about it.

Please keep this in mind:

Don’t do a refactoring in the middle of making another change.

If you are working on a story and in the middle of making a code change when you discover the need to refactor something, make a note of it (I usually create a chore in Pivotal Tracker) and forget about it until you’re done with the change in progress. After you complete the change, come back and do the refactoring. Make sure all tests are green before starting to refactor, and are green when done. The refactoring change should be a separate commit in git (separate checkin in SVN, etc).

OK, I’m pragmatic and realize that that approach doesn’t work all the time, but it’s a good ideal to shoot for. I considered discussing cases where it would be OK to refactor something in the middle of another change, but on second thought I think I’ll leave that be for now. You’ll learn that for yourself better than by following someone else’s advice on the subject.

Programming Your Home: Automate with Arduino, Android, and Your Computer now in beta

This post is by Pragmatic Bookshelf from Pragmatic Bookshelf

Click here to view on the original site: Original Post

Programming Your Home: Automate with Arduino, Android, and Your Computer now in beta

What Ruby’s ||= (Double Pipe / Or Equals) Really Does

This post is by Peter Cooper from Ruby Inside

Click here to view on the original site: Original Post

In Rubyists Already Use Monadic Patterns, Dave Fayram made a passing reference to using ||= to set a variable’s value if its value were ‘Nothing’ (false or nil in Ruby). The resulting Reddit quickly picked up on his definition (which was fixed later) and argued about ||=‘s true meaning which isn’t as obvious as many Rubyists think. This spread to Freenode’s awesome #ruby-lang IRC channel where I picked it up.

Abstract (or the TLDR Version)

A common misconception is that a ||= b is equivalent to a = a || b, but it behaves like a || a = b

In a = a || b, a is set to something by the statement on every run, whereas with a || a = b, a is only set if a is logically false (i.e. if it’s nil or false) because || is ‘short circuiting’. That is, if the left hand side of the || comparison is true, there’s no need to check the right hand side.

The Common Misconception

a ||= b being equivalent to a = a || b is a popular interpretation for two reasons:

  1. If a and b are both local variables, a = a || b is a short and natural reflection of the outcome.
  2. Other operators like += and -= do operate this way (and this standard dates back to C), e.g.: a += b is equivalent to a = a + b

Do not confuse [op]= with anything related to ||= or &&=. They’re entirely different ideas and are implemented entirely different[ly].

Evan Phoenix (of Rubinius fame)

What’s happening then, if not a = a || b?

A Starter for One

Here’s a simple example of using a ||= b:

a = nil
b = 20
a ||= b
a        # => 20

In this case, a ||= b seems to behave like a = a || b. As mentioned earlier, this is entirely due to a and b both being local variables.

Full Demonstration for Hashes and Arrays

Let’s try something more complicated:

h = {}

def h.[]=(k, v)
  puts "Setting hash key #{k} with #{v.inspect}"

# 1. The standard ||= approach
h[:x] ||= 10
h[:x] ||= 20

# 2. The a = a || b approach
h[:y] = h[:y] || 10
h[:y] = h[:y] || 20

# 3. The a || a = b approach
h[:z] || h[:z] = 10
h[:z] || h[:z] = 20

The output:

Setting hash key x with 10
Setting hash key y with 10
Setting hash key y with 10
Setting hash key z with 10

Note that in the first case, using ||=, the hash key’s value is only set once. Once it becomes logically truthful (i.e. anything other than nil or false), h[:x] is no longer assigned any new values, not even itself.

The second case, using the a = a || b approach, does result in two assignments (of the same value). The value remains 10 but the syntax forces h[:y] to assign itself as a value again.

In the last case, the behavior is the same as in the first case, demonstrating that a || a = b is a more realistic notation.

Note: Exactly the same result occurs if we switch the hash for an array and the keys for integers.

Full Demonstration for Getter/Setter Methods

A similar outcome occurs if we’re referring to objects with getter/setter methods (which you may call accessors):

class MyClass
  attr_reader :val

  def val=(val)
    puts "Setting val to #{val.inspect}"
    @val = val

# 1. The standard ||= approach
obj = MyClass.new
obj.val ||= 'a'
obj.val ||= 'b'

# 2. The a = a || b approach
obj = MyClass.new
obj.val = obj.val || 'c'
obj.val = obj.val || 'd'

# 3. The a || a = b approach
obj = MyClass.new
obj.val || obj.val = 'e'
obj.val || obj.val = 'f'

And the output shows off similar behavior to the hash and array example:

Setting val to "a"
Setting val to "c"
Setting val to "c"
Setting val to "e"

Default Hash Values: A Sneaky Edge Case?

Our travels don’t end there though. Back in 2008, David Black noticed an edge case with hashes that have default values. If you follow the logic above to the letter, this case will not surprise you, although from a pragmatic point of view, it’s curious.

Let’s take a look:

hsh = Hash.new('default')

hsh[:x]         # => 'default'

# 1. The standard ||= approach
hsh[:x] ||= 10
p hsh           # => {}

# 2. The a = a || b approach
hsh[:y] = hsh[:y] || 10
p hsh           # {:y=>"default"}

# 3. The a || a = b approach
hsh[:z] || hsh[:z] = 10
p hsh           # {:y=>"default"}

Hashes with default values act in an.. interesting way, depending on your point of view. Merely accessing a value doesn’t mean that the value is reified (made concrete) in the hash itself. The reason for this is that you can assign Procs to a hash’s default_proc in order to perform calculations (or even to set values) when an unset key is accessed. It would be undesirable to avoid this behavior merely because a key was accessed earlier on.

Again, we note that the a || a = b-style approach gives the result closest to the reality of ||=.

describe “Conditional operator assignment ‘obj.meth op= expr'” do
it “is equivalent to ‘obj.meth op obj.meth = expr'” do

RubySpec's variables_spec file

Further Reading

This appears to have been a popular discussion point in Rubyland over the years, so I would be remiss not to include links to some of the best references:

And if this tickled your fancy..

Today I’ve opened up tickets for the 3rd and 4th runs of my Ruby Reloaded online Ruby course. It’s aimed at intermediate developers who want to dig deeper, boost their confidence, and bolster their Ruby skill set. We dig into test driven development (TDD), object oriented design, building a library from scratch, code style, and more. It takes place in November and December.

Check out RubyReloaded.com to learn more about the course, what it involves, and when it runs. There are 24 places on each and about half have gone to waiting list folks so far.

P.S. The coupon code INSIDE will give you a $50 discount to thank you for being a Ruby Inside reader!

The Last Week in Ruby: Rails 3.1.1, Sinatra Recipes, Spree Gets Funded and more

This post is by Peter Cooper from Ruby Inside

Click here to view on the original site: Original Post

Back in 2008 and 2009, Ruby Inside had a long line of “Interesting Ruby Tidbits That Don’t Need Separate Posts” posts, aimed at sharing a collection of news and libraries in one hit. In the last year, I’ve shifted Ruby Inside to focusing on less frequent tutorials or investigative features and have been putting all of the news on Ruby Weekly, my weekly newsletter.

There are still many, though, who would prefer to read the news in their RSS readers or on the Web, so I’m going to be taking the things I find for Ruby Weekly each week, doing a little reformatting, and sharing them here on Ruby Inside too. The longer articles will then slot in nicely in between 🙂

So here we go, starting off from Ruby Weekly issue 63. You can check out the full 63 issue archive, if you like, or even sign up for Ruby Weekly here if you weren’t familiar with it. Or, of course, stay here on Ruby Inside and get the same (or more) each week – it’s your choice!

Without further ado..


Rails Recipes: Rails 3 Edition (in Beta)
Chad Fowler has been updating the Pragmatic Programmers’ Rails Recipes book to Rails 3.1 standards. It’s in beta now (as an e-book) with the full print release expected in December 2011.

Spree (Open Source Rails E-commerce System) Raises $1.5 Million
Spree is a popular open source Rails e-commerce system and its creator has raised $1.5m in venture capital to take it even further (as well as offer Spree-based consulting). Tom Preston Werner (GitHub) and James Lindenbaum (Heroku) have joined as advisors.

Articles and Tutorials

Sinatra Recipes – Handy Recipes for Working with Sinatra
Sinatra Recipes is a community contributed set of recipes and techniques for working with the popular Sinatra webapp library. There are examples of using many different libraries with Sinatra that are bound to prove useful, if only to learn from.

Give It A Pry
Pry is a powerful REPL environment for Ruby and an ideal alternative to IRB. Jon Jackson shows off his top 5 reasons for switching to Pry – maybe they’ll convince you too.

Rubyists Already Use Monadic Patterns
Monadic programming is a pattern that comes up in a lot of code, just like most patterns. While associated with pure functional language like Haskell, Dave Fayram demonstrates how many patterns used by Ruby developers are monadic too.

The Ruby 1.9 Walkthrough: Go Deep on Ruby 1.9
The Ruby 1.9 Walkthrough is a thorough, up-to-date video walkthrough of Ruby 1.9 – perfect for 1.8 developers who are unsure about the leap. Even Ruby 1.9 guru James Edward Gray II said he picked up plenty of stuff from it.. but beware, it’s long 🙂

Presentations and Videos

Gregory Moeck: Why You Don’t Get Mock Objects
Not a big fan of mock objects in testing? Don’t even know what mocks are? Get up to speed with Gregory Moeck who makes a convincing case for mocks in this RubyConf 2011 replay. In essence, if you’re doing object orientation properly, you need mocks (ooh, controversial!)

Your Data, Your Search: ElasticSearch
A wonderful Ruby-focused slide-deck by Karel Minarik (that was presented at EURUKO 2011) all about the concept of ‘searching’, the flaws in naive solutions, and a tour of the ElasticSearch system and using it from a Rails app.

Complex Ruby Concepts Simplified (Presentation)
At RubyConf 2011, Matt Aimonetti gave a presentation that dug into Ruby’s garbage collection, C interface, global interpreter lock, and more, and the slides are definitely easy (and worthwhile) to follow.

The Intro to Rails Screencast I Wish I Had
Over at NetTuts+, Jeffrey Way has put together an interesting 40 minute ‘introduction to Rails’ screencast that takes the high road and covers topics like TDD, auto testing, RSpec, and Capybara. It’s an introduction for people who want to get it right first try.

Libraries and code

Tire: A Rich Ruby API for the ElasticSearch Search Engine/Database System
Tire is a Ruby client for ElasticSearch, written by Karel Minarik. ElasticSearch is a scalable, distributed, cloud-ready, highly-available, full-text search engine and database with powerfull aggregation features, communicating by JSON over RESTful HTTP, based on Lucene, written in Java.

Queue Classic: A Powerful PostgreSQL-Backed Queueing Library
Queue Classic is a PostgreSQL-backed queueing library built by Ryan Smith of Heroku that focuses on concurrent job locking, minimizing database load and providing a simple, intuitive user experience.

Ruby Jobs of the Week

Sr (Agile) Software Engineer at Apple [Cupertino, CA]
Apple is seeking the very best engineers to be part of a continuously tested and integrated development process in its Developer Publications team. The systems they build are used for all Apple developer documentation for Mac OS X and iOS. You need deep knowledge of Ruby including Rails, RSpec, Bundler and Devise.

Last but not least..

The Ruby Toolbox Gets A Makeover
The Ruby Toolbox is a popular site that categorizes and rates gems by their popularity and functionality. If you’re looking for a gem and you can’t quite figure out which ones are out there, it’s worth a look. A recent redesign has really kicked things up a notch.

#290 SOAP with Savon

This post is by Ryan Bates from RailsCasts

Click here to view on the original site: Original Post

Communicating with a SOAP API can be a daunting task. Savon makes this easier by presenting the SOAP API through a Ruby interface.

Rails 3.1.1, Pry, Ruby Toolbox

This post is by Jason Seifer and Dan Benjamin from The Ruby Show

Click here to view on the original site: Original Post

Jason and Peter talk about Rails 3.1.1, rbenv, the Ruby Toolbox, and more.

Rails Recipes: Rails 3 Edition now in beta

This post is by Pragmatic Bookshelf from Pragmatic Bookshelf

Click here to view on the original site: Original Post

Rails Recipes: Rails 3 Edition now in beta

Thanking Ruby Inside’s September 2011 Supporters

This post is by Peter Cooper from Ruby Inside

Click here to view on the original site: Original Post

Ruby Inside wouldn’t be what it is without you but it’s time for me to thank the companies who also help to keep Ruby Inside going by sponsoring my work. Thanks!

I take care not to accept sponsors who have little of interest to the Ruby scene so hopefully you’ll find something useful below – it’s not a roster of faceless companies, these folks are doing great stuff.

Gauges – Simple, Sexy Real-time Analytics

Gauges is a tool for collecting and analyzing the Web traffic for all your sites in real-time using a fast, reliable, hosted system. You can even see overview data for all your sites on a single page. It comes from Ordered List, the same folks who built Harmony.

CodeSchool – Learn By Doing

CodeSchool is an innovative, interactive online marketplace where you can learn to code directly in your browser. Courses so far include the FREE “Rails for Zombies” (and forthcoming Rails for Zombies 2), Functional HTML5 & CSS3, and Rails Best Practices. They have some great stuff in the pipeline and if you’re looking to pick up some new skills, definitely check them out.

New Relic — On-demand Application Management

New Relic is a full-stack Java, Ruby, PHP, and soon Python, application performance and management app that started life as a Rails-only service.

New Relic has long dominated the performance monitoring scene, particularly amongst Rails apps (folks like 37signals and Shopify use them heavily), but they’ve not rested on their laurels. Just a few months ago they released a Real User Monitoring service which goes right down to the customer experience. How quick pages load, how quick the pages are to render, etc.

Cloudmailin – Incoming Email for your Web App (As A Service)

Cloudmailin is a cloud service that can accept e-mail and then send the required data, real time, to your webapp over an HTTP POST request. Take the strain out of hosting your own e-mail infrastructure and let Cloudmailin take care of it instead.

#288 Billing with Stripe

This post is by Ryan Bates from RailsCasts

Click here to view on the original site: Original Post

Stripe is a full-stack payment solution with very reasonable pricing and is easy to setup. See how to add it to a Rails application here. Currently only available in the US.

Rails 3.1.1 has been released!

This post is by spastorino from Riding Rails - home

Click here to view on the original site: Original Post

Hi everyone,

Rails 3.1.1 has been released. This release requires at least sass-rails 3.1.4



  • No changes


  • stylesheetlinktag(‘/stylesheets/application’) and similar helpers doesn’t
    throw Sprockets::FileOutsidePaths exception anymore [Santiago Pastorino]

  • Ensure defaultassethost_protocol is respected, closes #2980. [José Valim]

    Changing rake db:schema:dump to run :environment as well as :load_config,
    as running :load_config alone will lead to the dumper being run without
    including extensions such as those included in foreigner and

    This reverses a change made here:

    I’m assuming here that :load_config needs to be invoked
    separately from :environment, as it is elsewhere in the
    file for db operations, if not the alternative is to go
    back to “task :dump => :environment do”.

    [Ben Woosley]

  • Update to rack-cache 1.1.

    Versions prior to 1.1 delete the If-Modified-Since and If-Not-Modified
    headers when config.actioncontroller.performcaching is true. This has two

    • unexpected inconsistent behaviour between development &
      production environments
    • breaks applications that use of these headers

    [Brendan Ribera]

  • Ensure that enhancements to assets:precompile task are only run once [Sam Pohlenz]

  • TestCase should respect the view_assigns API instead of pulling variables on
    its own. [José Valim]

  • javascriptpath and stylesheetpath now refer to /assets if asset pipelining
    is on. [Santiago Pastorino]

  • button_to support form option. Now you’re able to pass for example
    ‘data-type’ => ‘json’. [ihower]

  • imagepath and imagetag should use /assets if asset pipelining is turned
    on. Closes #3126 [Santiago Pastorino and christos]

  • Avoid use of existing precompiled assets during rake assets:precompile run.
    Closes #3119 [Guillermo Iguaran]

  • Copy assets to nondigested filenames too [Santiago Pastorino]

  • Give precedence to config.digest = false over the existence of
    manifest.yml asset digests [christos]

  • escape options for the stylesheetlinktag method [Alexey Vakhov]

  • Re-launch assets:precompile task using (Rake.)ruby instead of Kernel.exec so
    it works on Windows [cablegram]

  • env var passed to process shouldn’t be modified in process method. [Santiago

  • rake assets:precompile loads the application but does not initialize

    To the app developer, this means configuration add in
    config/initializers/* will not be executed.

    Plugins developers need to special case their initializers that are
    meant to be run in the assets group by adding :group => :assets. [José Valim]

  • Sprockets uses config.assets.prefix for asset_path [asee]

  • FileStore keyfilepath properly limit filenames to 255 characters. [phuibonhoa]

  • Fix Hash#toquery edge case with htmlsafe strings. [brainopia]

  • Allow asset tag helper methods to accept :digest => false option in order to completely avoid the digest generation.
    Useful for linking assets from static html files or from emails when the user
    could probably look at an older html email with an older asset. [Santiago Pastorino]

  • Don’t mount Sprockets server at config.assets.prefix if config.assets.compile is false. [Mark J. Titorenko]

  • Set relative url root in assets when controller isn’t available for Sprockets (eg. Sass files using asset_path). Fixes #2435 [Guillermo Iguaran]

  • Fix basic auth credential generation to not make newlines. GH #2882

  • Fixed the behavior of asset pipeline when config.assets.digest and config.assets.compile are false and requested asset isn’t precompiled.
    Before the requested asset were compiled anyway ignoring that the config.assets.compile flag is false. [Guillermo Iguaran]

  • CookieJar is now Enumerable. Fixes #2795

  • Fixed AssetNotPrecompiled error raised when rake assets:precompile is compiling certain .erb files. See GH #2763 #2765 #2805 [Guillermo Iguaran]

  • Manifest is correctly placed in assets path when default assets prefix is changed. Fixes #2776 [Guillermo Iguaran]

  • Fixed stylesheetlinktag and javascriptincludetag to respect additional options passed by the users when debug is on. [Guillermo Iguaran]

  • Fix ActiveRecord#exists? when passsed a nil value

  • Fix assertselectemail to work on multipart and non-multipart emails as the method stopped working correctly in Rails 3.x due to changes in the new mail gem.


  • Remove hard dependency on bcrypt-ruby to avoid make ActiveModel dependent on a binary library.
    You must add the gem explicitly to your Gemfile if you want use ActiveModel::SecurePassword:

    gem ‘bcrypt-ruby’, ‘~> 3.0.0’

    See GH #2687. [Guillermo Iguaran]


  • Add deprecation for the preload_associations method. Fixes #3022.

    [Jon Leighton]

  • Don’t require a DB connection when loading a model that uses setprimarykey. GH #2807.

    [Jon Leighton]

  • Fix using select() with a habtm association, e.g. Person.friends.select(:name). GH #3030 and #2923.

    [Hendy Tanata]

  • Fix belongs_to polymorphic with custom primary key on target. GH #3104.

    [Jon Leighton]

  • CollectionProxy#replace should change the DB records rather than just mutating the array.
    Fixes #3020.

    [Jon Leighton]

  • LRU cache in mysql and sqlite are now per-process caches.

    • lib/activerecord/connectionadapters/mysql_adapter.rb: LRU cache
      keys are per process id.
    • lib/activerecord/connectionadapters/sqlite_adapter.rb: ditto
  • Database adapters use a statement pool for limiting the number of open
    prepared statments on the database. The limit defaults to 1000, but can
    be adjusted in your database config by changing ‘statement_limit’.

  • Fix clash between using ‘preload’, ‘joins’ or ‘eager_load’ in a default scope and including the
    default scoped model in a nested through association. (GH #2834.) [Jon Leighton]

  • Ensure we are not comparing a string with a symbol in HasManyAssociation#inverseupdatescounter_cache?.
    Fixes GH #2755, where a counter cache could be decremented twice as far as it was supposed to be.

    [Jon Leighton]

  • Don’t send any queries to the database when the foreign key of a belongs_to is nil. Fixes
    GH #2828. [Georg Friedrich]

  • Fixed findin_batches method to not include order from defaultscope. See GH #2832 [Arun Agrawal]

  • Don’t compute table name for abstract classes. Fixes problem with setting the primary key
    in an abstract class. See GH #2791. [Akira Matsuda]

  • Psych errors with poor yaml formatting are proxied. Fixes GH #2645 and
    GH #2731

  • Use the LIMIT word with the methods #last and #first. Fixes GH #2783 [Damien Mathieu]


  • No changes


  • ruby193: String#prepend is also unsafe [Akira Matsuda]

  • Fix obviously breakage of Time.=== for Time subclasses [jeremyevans]

  • Added fix so that file store does not raise an exception when cache dir does
    not exist yet. This can happen if a delete_matched is called before anything
    is saved in the cache. [Philippe Huibonhoa]

  • Fixed performance issue where TimeZone lookups would require tzinfo each time [Tim Lucas]

  • ActiveSupport::OrderedHash is now marked as extractable when using Array#extract_options! [Prem Sichanugrist]


  • Add jquery-rails to Gemfile of plugins, test/dummy app needs it. Closes #3091. [Santiago Pastorino]

  • rake assets:precompile loads the application but does not initialize it.

    To the app developer, this means configuration add in
    config/initializers/* will not be executed.

    Plugins developers need to special case their initializers that are
    meant to be run in the assets group by adding :group => :assets.


  • 9337cff7772da034b0b34b73b85cf249f1a70f52 actionmailer-3.1.1.gem
  • 7bb1b8d096a6ff1ff46dcfb778bf86a5daca1b0d actionpack-3.1.1.gem
  • d5dc71e1a9a0e20d819f4dff27ff0697e99a7f64 activemodel-3.1.1.gem
  • 7245632cb3b38612628304c1e244855d0053f7be activerecord-3.1.1.gem
  • 6d09800202c2747e84249b8646f0fd480ed4924f activeresource-3.1.1.gem
  • 66df2fd144aab22f52819fd489e33a976d68a46b activesupport-3.1.1.gem
  • 6a35a49948bbd9f461839a1a271def90b23a851a rails-3.1.1.gem
  • 6979ef891bd03fb639b979af9fdc56781f9358d9 railties-3.1.1.gem

You can find an exhaustive list of changes on github. Along with the closed issues marked for v3.1.1.

Thanks to everyone!


This post is by noelrap from Rails Test Prescriptions Blog

Click here to view on the original site: Original Post

I wasn’t going to write this, because it’s not like the Internet has a dearth of people writing about Steve Jobs who never knew him or interacted with him in any way. I wrote it anyway.

I’ve watched the first few minutes of the keynote introducing the iPhone several times. It amazes me – both as a seminal moment of technology and as a presentation. Jobs starts of by saying he’s been looking forward to this day for two-and-a-half years, and that he’s been fortunate to work on multiple “revolutionary” products in his career.

He says that “Today, we’re introducing three revolutionary products” – remember this part?:

  • “A widescreen iPod with touch controls” – he says, and the crowd goes nuts.
  • “A revolutionary mobile phone” – the crowd goes berserk, this is what they came for.
  • “A breakthrough internet communications device” – polite applause, but really, nobody knows what the hell he’s talking about.

He repeats the phrases, makes it clear that he’s talking about one device, “and we are calling it… iPhone”. Then he shows a gag picture of an old iPod with a rotary dial, and it’s funny – not a phrase normally associated with Jobs’ keynotes.

It’s a fantastic performance. Here’s the thing… People went crazy for the iPod and phone parts. Almost five years later, there’s no doubt that that part that nobody got at first – the internet communicator – is far and away the most revolutionary part of the iPhone experience. I had a phone in my pocket before 2007. I had an iPod in my pocket before 2007. The biggest change to my behavior from the iPhone is the way I can access the Internet from my pocket. (Yes, I know there were mobile phones that could connect to the Internet before the iPhone. I even used some. It wasn’t the same thing in an way.)

Which makes me wonder, why describe the device as an “internet communicator” at all, let alone have it as the last part of the description? I mean, it’s nice to have three beats in description, but the build from iPod (yay!) to phone (YAY!) to “Internet communicator” (huh?) is certainly weird. I assume that the “Internet communicator” part is there because somebody – presumably Jobs – felt that it was going to be important. Placed it last because it was most important. Even if nobody else realized that yet.

It’s been interesting to see how Jobs has been described in media reports, and how none of the descriptions quite fit. “Inventor”, “pioneer”, “visionary”, “technology titan”. They all have a grain of truth, but it’s almost impossible to imagine a short phrase that could encapsulate exactly what Jobs’ role was in all of these revolutionary products. At this point, the glib, writerly thing to do would be to claim that “Internet communicator” is the phrase that fits. It’s tempting, but kind of forced.

I used to say this: “Apple is a long-range experiment in how much people will pay for good design. And the answer is not much”. I said this for years, probably first around 1994. It’s become less and less true over the past few years, not because Apple is any less a design experiment, but because the audience has finally caught up with them and more and more people have been willing to pay for devices that are well designed. Jobs was the curator of that design sense, and that design sense has shaped the tools I use and the way I live and work.

Filed under: Apple