<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:dc="http://purl.org/dc/elements/1.1/" version="2.0"><channel><atom:link rel="hub" href="http://tumblr.superfeedr.com/" xmlns:atom="http://www.w3.org/2005/Atom"/><description></description><title>Brian Cardarella's Blog</title><generator>Tumblr (3.0; @bcardarella)</generator><link>http://bcardarella.com/</link><item><title>Clean up trailing whitespace</title><description>&lt;p&gt;One line command to clean up the trailing whitespace for a given project:&lt;/p&gt;
&lt;pre class="brush: plain"&gt;
find . -name "*.rb" -type f -print0 | xargs -0 sed -i '' "s/[[:space:]]*$//"
&lt;/pre&gt;
&lt;p&gt;This command will search for any files with the “rb” extension (Ruby files) and remove all trailing whitespace. This works in OSX, the command syntax might be different in Linux. Run this command from your project’s root.&lt;/p&gt;</description><link>http://bcardarella.com/post/8682039114</link><guid>http://bcardarella.com/post/8682039114</guid><pubDate>Tue, 09 Aug 2011 03:16:00 -0400</pubDate><category>osx</category><category>sed</category><category>trailing whitespace</category></item><item><title>The State Open Source Development</title><description>&lt;img src="http://i.imgur.com/amys8.png" alt="" title="Patches welcome"/&gt;&lt;p&gt;My thoughts on the subtext of dealing with some open source project maintainers&lt;/p&gt;</description><link>http://bcardarella.com/post/8008403283</link><guid>http://bcardarella.com/post/8008403283</guid><pubDate>Sun, 24 Jul 2011 14:25:00 -0400</pubDate></item><item><title>Every pub and cafe should have free wifi and power.</title><description>&lt;p&gt;
Getting a cable connection and sharing over wifi with your customers is a great way to not only have customers all day long but repeat customers. But the real reason why every pub and cafe should today install free wifi is because in a few years they won’t need it and they need to learn how to sell to the customers who can “work from anywhere”.&lt;/p&gt;
&lt;h3&gt;Tethering is awesome&lt;/h3&gt;
&lt;p&gt;With my Android I tether my MacbookPro over 3G. Most of the time the connection is crap and slow and I’m afraid of data usage but for the most part it gives me the freedom I want. 10 years from now I fully expect my MacbookPro Air (please?) to have a multi-mode network card that does wifi and Wimax or LTE (or something better). With a national subscription plan I could connect anywhere I want in a similar fashion to my iPhone. But we don’t even have to wait 10 years for the speed. 4G phones are here. Batteries and power consumption is getting better. On a single charge my MacbookPro can get 4 - 5 hours doing just software development. Being able to plug in is nice but becoming less necessary. (but still necessary today)&lt;/p&gt;
&lt;h3&gt;Pubs and cafes need to learn how to deal with remote workers&lt;/h3&gt;
&lt;p&gt;
So now that the world is almost my office I will be able to pick and choose which pub or cafe I want to work at. I’ll no longer be limited to Starbucks and Panera bread. I’m going to choose the place that has the food I like, the beer I prefer or the working environment I’m most productive in. If pubs and cafes were smart they would learn how best to accomodate this class of worker today by providing free wifi. A small investment today would go a long way to getting ahead of everybody else tomorrow.
&lt;/p&gt;
&lt;p&gt;Panera Bread (I’m assuming most people are familiar) recently put restrictions on their free wifi. During peak hours it is limited. Someone might use this to claim that free wifi actually harms business. The reasoning is that most of the people there just hang out all day, some might actually bring their own food. Well, if you were in the desert wouldn’t you expect everybody to be hanging around the oasis?  If there was more access at more locations everybody would be more spread out. Businesses should be competing for those potential customers not looking at them as moochers. Getting people to just walk through the door is difficult. Keeping them there for hours is impossible. The business that can figure out how best to sell to these remote workers is going to do very well in the years to come.&lt;/p&gt;</description><link>http://bcardarella.com/post/7044433281</link><guid>http://bcardarella.com/post/7044433281</guid><pubDate>Wed, 29 Jun 2011 10:17:00 -0400</pubDate></item><item><title>ClientSideValidations for Rails 3.1 and 2.3.x backport</title><description>&lt;p&gt;Today I’ve made two new releases: &lt;a href="https://github.com/bcardarella/client_side_validations" target="_blank"&gt;ClientSideValidations v3.1 for Rails 3.1&lt;/a&gt; and a &lt;a href="https://github.com/bcardarella/client_side_validations-rails_2" target="_blank"&gt;backport of ClientSideValidations for Rais 2&lt;/a&gt;
&lt;/p&gt;
&lt;h3&gt;ClientSideValidations v3.1&lt;/h3&gt;
&lt;p&gt;ClientSideValidaitons for Rails 3.1 adds the javascript file to the asset pipeline. So you no longer need to run the install generator for each update. Just serve up rails.validaitons.js in your application.js file:&lt;/p&gt;
&lt;pre class="brush: js"&gt;
//= require rails.validations
&lt;/pre&gt;
&lt;p&gt;And that’s it! Other updates:
&lt;/p&gt;&lt;ul&gt;&lt;li&gt;Rails 3.0 support will continue in the 3.1 version of ClientSideValidations. But for legacy support the 3-0-stable branch will also be maintained.&lt;/li&gt;
&lt;li&gt;Formtastic 2 support. If you want Formtastic 1.x support please use ClientSideValidations 3.0.x. Formtastic 2 is required when using Rails 3.1&lt;/li&gt;
&lt;/ul&gt;&lt;h3&gt;ClientSideValidations-Rails2&lt;/h3&gt;
&lt;p&gt;This is a new gem that provides some validation reflection to ActiveRecord 2.x models. It will use the ClientSideValidations 3.0.x series gem.&lt;/p&gt;</description><link>http://bcardarella.com/post/6733907607</link><guid>http://bcardarella.com/post/6733907607</guid><pubDate>Mon, 20 Jun 2011 17:17:00 -0400</pubDate></item><item><title>ValidAttribute 1.0</title><description>&lt;p&gt;I just released &lt;a href="https://github.com/bcardarella/valid_attribute" target="_blank"&gt;ValidAttribute 1.0&lt;/a&gt; So what is ValidAttribute and why should you be using it?&lt;br/&gt;
See the &lt;a href="https://github.com/bcardarella/valid_attribute/blob/master/README.markdown" target="_blank"&gt;README&lt;/a&gt; for installation information.&lt;/p&gt;
&lt;p&gt;I grew frustrated with how I was writing the specs for my models. Very often I found myself doing this:&lt;/p&gt;
&lt;pre class="brush: ruby"&gt;
describe User do
  it { should validate_presence_of :name }
  it { should validate_length_of :name, :is =&gt; 5 }
end
&lt;/pre&gt;
&lt;p&gt;
This felt wrong. I was duplicating the effort of writing the validations in the spec, the implementation of how these validations worked was now tied to the spec. My specs shouldn’t care about what validations my model is using. The &lt;strong&gt;only&lt;/strong&gt; thing my specs should care about is if a given value is valid or invalid under certain circumstances. So I wrote out a simple DSL of how I wanted this to work:&lt;/p&gt;
&lt;pre class="brush: ruby"&gt;
describe User do
  it { should have_valid(:name).when('Brian') }
  it { should_not have_valid(:name).when(nil, '', 'Ed') }
end
&lt;/pre&gt;
&lt;p&gt;This felt much better. Now my specs do not care what validations I have declared on my model just as long as the values I provide are valid or not. I have been using this simple matcher for a few months and have found it provides a nicer BDD process than Shoulda or Remarkable. In fact, it is all I use to test my models now. (I won’t get into why specing your relationships in models is a waste of time)&lt;/p&gt;
&lt;p&gt;
So what about other validations like uniqueness and confirmation. It is pretty simple:&lt;/p&gt;
&lt;pre class="brush: ruby"&gt;
describe User do
  context '#email' do
    before { Factory(:user, :email =&gt; 'test@test.com' }
    it { should have_valid(:email).when('brian@test.com') }
    it { shoud_not have_valid(:email).when(nil, '', 'abc', 'test@test.com') }
  end

  context '#password' do
    before { subject.password_confirmation = 'password' }
    it { should have_valid(:password).when('password') }
    it { should_not have_valid(:password).when(nil, '', 'badpassword') }
  end
end
&lt;/pre&gt;
&lt;p&gt;
ValidAttribute also works with Test::Unit. You need to be using &lt;a href="http://thoughtbot.com/" target="_blank"&gt;thoughtbot&lt;/a&gt;’s &lt;a href="https://github.com/thoughtbot/shoulda-context" target="_blank"&gt;shoulda-context&lt;/a&gt;:&lt;/p&gt;
&lt;pre class="brush: ruby"&gt;
class UserTest &lt; Test::Unit::TestCase
  should have_valid(:name).when('Brian')
  should_not have_valid(:name).when(nil, '', 'Ed')

  context '#password' do
    subject { User.new(:password_confirmation =&gt; 'password') }
    should have_valid(:password).when('password')
    should_not have_valid(:password).when(nil, '', 'badpassword')
  end
end
&lt;/pre&gt;
&lt;p&gt;ValidAttribute is compatible with any ActiveModel based model. It also supports ActiveRecord 2.x and Datamapper. In fact, as long as your model responds to &lt;strong&gt;#valid?&lt;/strong&gt; and &lt;strong&gt;#errors&lt;/strong&gt; you can use ValidAttribute. See the &lt;a href="https://github.com/bcardarella/valid_attribute/blob/master/README.markdown" target="_blank"&gt;README&lt;/a&gt; for more information.

&lt;/p&gt;&lt;h2&gt;ValidAttribute Vs Shoulda’s #allow_value&lt;/h2&gt;
&lt;p&gt;
Shoulda has a method its matchers depend upon called #allow_value which provides something similar to ValueAttribute. Here is the difference:
&lt;/p&gt;
&lt;pre class="brush: ruby"&gt;
describe User do

  # ValidAttribute Syntax
  context '#email' do
    before { Factory(:user, :email =&gt; 'test@test.com' }
    it { should have_valid(:email).when('brian@test.com', 'brian+blog@test.com') }
    it { shoud_not have_valid(:email).when(nil, '', 'abc', 'test@test.com') }
  end

  # Shoulda's #allow_value Syntax
  context '#email' do
    before { Factory(:user, :email =&gt; 'test@test.com' }
    %w{brian@test.com brian+blog@test.com}.each do |email|
      it { should allow_value(email).for(:email) }
    end
    [nil, '', 'abc', 'test@test.com'].each do |email|
      it { should_not allow_value(email).for(:email) }
    end
  end
end
&lt;/pre&gt;
&lt;p&gt;#allow_value only takes one value, and the wording feels backwards.
&lt;/p&gt;
&lt;p&gt;To accomplish the same task #allow_value needs to iterate over a collection of values and inject each into the matcher. ValidAttribute can take any number of values. Clean code is very important to me.
&lt;/p&gt;
&lt;p&gt;Here is another example:&lt;/p&gt;

&lt;pre class="brush: ruby"&gt;
describe User do

  # ValidAttribute Syntax
  context '#email' do
    before { Factory(:user, :email =&gt; 'test@test.com' }
    it { should have_valid(:email).when('brian@test.com', 'brian+blog@test.com') }
    it { shoud_not have_valid(:email).when(nil, '', 'abc', 'test@test.com') }
  end

  # Shoulda's #allow_value Syntax
  context '#email' do
    before { Factory(:user, :email =&gt; 'test@test.com' }
    it 'should have valid email' do
      %w{brian@test.com brian+blog@test.com}.each do |email|
        subject.should allow_value(email).for(:email)
      end
    end
    it 'should not have valid email' do
      [nil, '', 'abc', 'test@test.com'].each do |email|
        should_not allow_value(email).for(:email)
      end
    end
  end
end
&lt;/pre&gt;
&lt;p&gt;In this 2nd example the iterators for #allow_value are inside of an ‘it’ block. If the validators have not been implemented yet ValidAttribute will give you a failure message containing all the values that caused a failure. Shoulda will stop on the first value.&lt;/p&gt;</description><link>http://bcardarella.com/post/6458785026</link><guid>http://bcardarella.com/post/6458785026</guid><pubDate>Sun, 12 Jun 2011 13:46:00 -0400</pubDate></item><item><title>The Github Follower Problem</title><description>&lt;p&gt;Github is awesome. I think most people agree. They have proven the concept of “social coding”. The big flaw in this plan is Github’s relationship system.&lt;/p&gt;
&lt;p&gt;Following people on Github is easy. I see somebody interesting, I click follow. The problem is that now my news feed will get every single commit, message, etc… this person does. After following a few active people my feed turns into noise and becomes useless. I used to follow up to 100 people on Github, and over 200 projects. I have since unfollowed all but a handful and only follow maybe 5 projects. I’m very interested in knowing what is happening in Rails core so my news feed is now very useful.&lt;/p&gt;
&lt;p&gt;So the way I see it there is very little incentive to follow people on Github. In fact, because of the news feed issue I feel almost penalized for following somebody. In return I’m sure others feel the same way. This would not be a problem if it weren’t for Github search.&lt;/p&gt;
&lt;p&gt;Github is becoming a great place to find new talent. If you are a contract developer being found easily if very important. So if I &lt;a href="https://github.com/search?langOverride=Ruby&amp;language=&amp;q=location%3A+Boston&amp;repo=&amp;start_value=1&amp;type=Users&amp;x=0&amp;y=0" target="_blank"&gt;search for all Ruby developers in Boston, MA&lt;/a&gt; I get a result that is ordered by number of followers descending.&lt;/p&gt;
&lt;p&gt;
&lt;img src="https://lh4.googleusercontent.com/-gNtsd7XSIKA/TeZqj-UWAVI/AAAAAAAAAXE/5IHPnL6kFrI/s800/followers.png"/&gt;&lt;/p&gt;
&lt;p&gt;Ah ha! Now the number of followers I have becomes &lt;strong&gt;very&lt;/strong&gt; important.&lt;/p&gt;
&lt;p&gt;I’m not suggesting people start gaming Github. But it would be nice if there was more incentive to following people than just cluttering your news feed.&lt;/p&gt;
&lt;p&gt;Searching by the exact city match is also not very useful. A good number of &lt;a href="https://github.com/search?type=Users&amp;language=Ruby&amp;q=location%3A+Cambridge&amp;repo=&amp;langOverride=&amp;x=0&amp;y=0&amp;start_value=1" target="_blank"&gt;Ruby devs live in Cambridge, MA&lt;/a&gt; but I can’t search for “Cambridge, MA” only “Cambridge” which also returns “Cambridge, UK”. It would be nice if I could search for Boston, MA and Github did a proximity search. Maybe 5 miles?
&lt;br/&gt;&lt;br/&gt;&lt;strong&gt;Update: &lt;/strong&gt;Apparently if you &lt;a href="https://github.com/search?type=Users&amp;language=Ruby&amp;q=location%3A+Cambridge_MA&amp;repo=&amp;langOverride=&amp;x=0&amp;y=0&amp;start_value=1" target="_blank"&gt;search by “Cambridge_MA”&lt;/a&gt; you’ll get what you want. Strange.&lt;/p&gt;</description><link>http://bcardarella.com/post/6075296352</link><guid>http://bcardarella.com/post/6075296352</guid><pubDate>Wed, 01 Jun 2011 12:47:00 -0400</pubDate></item><item><title>We choose not to go back to the moon...</title><description>&lt;div style="margin-left: 100px; margin-right: 100px;"&gt;
&lt;p&gt;
&lt;span style="font-size: 1.5em"&gt;We choose not to go back to the moon.&lt;/span&gt; We choose not to go back to the moon in this lifetime and not do the other things, not because they are hard, but because they are expensive, because our goals are now self-serving, because the challenge is one that we are unwilling to afford, one that we are willing to postpone, and one which we intend to ignore.
&lt;/p&gt;
&lt;p style="text-align:right"&gt;Sad, but true…&lt;/p&gt;
&lt;/div&gt;</description><link>http://bcardarella.com/post/6045902598</link><guid>http://bcardarella.com/post/6045902598</guid><pubDate>Tue, 31 May 2011 16:26:00 -0400</pubDate></item><item><title>Exploring Rails 3.1 - ActiveModel::SecurePassword</title><description>&lt;p&gt;Rails 3.1 will have password encryption baked in via &lt;a href="https://github.com/rails/rails/blob/master/activemodel/lib/active_model/secure_password.rb" target="_blank"&gt;ActiveModel::SecurePassword&lt;/a&gt;. Any ActiveModel based model will get this functionality. (ActiveRecord, &lt;a href="http://mongoid.org" target="_blank"&gt;Mongoid&lt;/a&gt;)&lt;/p&gt;

&lt;p&gt;Your model will need a field called &lt;b&gt;password_digest&lt;/b&gt; and then you’ll need to activate secure password:&lt;/p&gt;
&lt;pre class="brush: ruby"&gt;
class User &lt; ActiveRecord::Base
   has_secure_password
end
&lt;/pre&gt;
&lt;p&gt;You get a few things from this
&lt;/p&gt;&lt;ul&gt;&lt;li&gt;attr_accessor :password&lt;/li&gt;
&lt;li&gt;confirmation validator on password&lt;/li&gt;
&lt;li&gt;presence validator on password_digest&lt;/li&gt;
&lt;li&gt;when password is set password_digest is encrypted using &lt;a href="http://bcrypt-ruby.rubyforge.org"&gt;bcrypt-ruby&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;#authenticate takes one argument of an unencrypted password. The unencrypted password will be encrypted and compared to the password_digest. If the two match &lt;b&gt;self&lt;/b&gt; is returned. If the match fails &lt;b&gt;false&lt;/b&gt; is returned.&lt;/li&gt;
&lt;/ul&gt;

You don’t get any validators on the &lt;b&gt;password&lt;/b&gt; accessor. While there is an indirect validator with the presence validator on &lt;b&gt;password_digest&lt;/b&gt; this won’t work for your forms. You may want to add one:
&lt;pre class="brush: ruby"&gt;
class User &lt; ActiveRecord::Base
  has_secure_password
  validates :password, :presence =&gt; { :on =&gt; :create }
end
&lt;/pre&gt;

&lt;p&gt;
Now you can authenticate in your controllers like so:&lt;/p&gt;
&lt;pre class="brush: ruby"&gt;
class ApplicationController
  helper_method :current_user, :user_signed_in?, :user_signed_out?

  def current_user
    if session[:user_id]
      @current_user ||= User.find(session[:user_id])
    end
    @current_user
  end

  def user_signed_in?
    !!current_user
  end

  def user_signed_out?
    !user_signed_in?
  end
end

class SessionController &lt; ApplicationController
  before_filter :user_signed_in?, :only =&gt; [:delete]

  def create
    if user = User.find_by_email(params[:user][:email]).try(:authenticate, params[:user][:password])
      session[:user_id] = user.id
      redirect_to root_path # Or whatever you want i.e. redirect_to user
    else
      render :new, :flash =&gt; { :error =&gt; "bad email/password combination" }
    end
  end

  def delete
    session.delete(:user_id)
  end
end
&lt;/pre&gt;</description><link>http://bcardarella.com/post/4668842452</link><guid>http://bcardarella.com/post/4668842452</guid><pubDate>Sat, 16 Apr 2011 16:46:00 -0400</pubDate><category>Rails 3.1</category><category>ActiveModel</category><category>Authentication</category><category>Ruby</category><category>ruby on rails</category></item><item><title>Setting cookies in the new Capybara</title><description>&lt;p&gt;Getting access to the cookie_jar is different for the new Capybara (the one that will have the acceptance test DSL)&lt;/p&gt;

&lt;p&gt;You’ll want to add a helper to spec/acceptance/support/cookie_helper.rb&lt;/p&gt;
&lt;pre class="brush: ruby"&gt;
def cookie_jar
   Capybara.current_session.driver.browser.current_session.instance_variable_get(:@rack_mock_session).cookie_jar
end
&lt;/pre&gt;
&lt;p&gt;Now you can access the cookies at any time:&lt;/p&gt;
&lt;pre class="brush:ruby"&gt;
#in some scenario
cookie_jar[:remember_token] = 'testtoken'
&lt;/pre&gt;</description><link>http://bcardarella.com/post/4561398850</link><guid>http://bcardarella.com/post/4561398850</guid><pubDate>Tue, 12 Apr 2011 17:31:47 -0400</pubDate></item><item><title>Why I love Rails and Github</title><description>&lt;p&gt;Today a &lt;a href="https://github.com/rails/rails/pull/258"&gt;pull request to r\Ruby on Rails&lt;/a&gt; was opened. In short, it added a few methods that allowed an alternative use of &lt;a href="http://ruby-doc.org/core/classes/Array.html#M000265"&gt;Array#include?&lt;/a&gt; I happened to notice that &lt;a href="https://github.com/josevalim"&gt;Jose Valim&lt;/a&gt; commented on it in my &lt;a href="https://github.com"&gt;Github&lt;/a&gt; news feed, so I checked it out. &lt;a href="https://github.com/rails/rails/pull/258#issuecomment-980868"&gt;I weighed in&lt;/a&gt; as I questioned the necessity for the added methods. Others began to weigh in too, and in short time we had a good conversation going.&lt;/p&gt;

&lt;p&gt;Other language or framework communities might dismiss this type of conversation as a waste of time. The culture of Ruby, and more so Rails, demand it. And Github allows the community as a whole to participate in it. Days like today are days that I’m happy to be a Ruby developer.&lt;/p&gt;</description><link>http://bcardarella.com/post/4508433986</link><guid>http://bcardarella.com/post/4508433986</guid><pubDate>Sun, 10 Apr 2011 19:37:00 -0400</pubDate></item><item><title>valid_attribute</title><description>&lt;p&gt;&lt;a href="https://github.com/bcardarella/valid_attribute"&gt;valid_attribute on Github&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;I’ve been writing model tests for years. Like most I started out with &lt;a href="https://github.com/thoughtbot.com/shoulda"&gt;Shoulda&lt;/a&gt; which was great. As I moved over to &lt;a href="https://github.com/rspec/"&gt;RSpec&lt;/a&gt; thankfully Shoulda moved over as well.&lt;/p&gt;
&lt;p&gt;After a while I began to hit some walls with Shoulda, specifically when I wanted to use some of the matchers for non-ActiveRecord models. I previously wrote a gem called &lt;a href="https://github.com/bcardarella/remarkable_mongoid"&gt;remarkable_mongoid&lt;/a&gt; that provided relation and validation matchers for &lt;a href="http://mongoid.org"&gt;Mongoid&lt;/a&gt;. I originally wanted to use Shoulda as it was my library of choice but the ActiveModel validators were part of the Shoulda ActiveRecord set. So I &lt;a href="http://groups.google.com/group/shoulda/browse_thread/thread/842db9cae0da3c64/70d0723e494ef6c5?lnk=gst&amp;q=cardarella#70d0723e494ef6c5"&gt; refactored Shoulda to separate the ActiveModel validator matchers from the ActiveRecord validator matchers&lt;/a&gt;. Unfortunately it never got any attention. (I’ve since deleted my local repo) I decided to go with &lt;a href="https://github.com/remarkable/remarkable"&gt;Remarkable&lt;/a&gt; which had the validators properly separated.&lt;/p&gt;
&lt;p&gt;My views on model testing have shifted since I wrote remarkable_mongoid. Specifically &lt;a href="http://stackoverflow.com/questions/5189384/which-gem-for-rspec-matchers-should-i-use-with-mongoid/5189711#5189711"&gt;I think relation matchers are crap&lt;/a&gt;. At the time I thought the same of validation matchers. My problem with validation matchers wasn’t with the necessity of them but how they were being implemented. Shoulda and Remarkable had similar APIs for how their matchers worked. Their validation matchers feel too tightly coupled with the implementation of the validations themselves. I would find myself writing a spec and a model like this:&lt;/p&gt;
&lt;script type="syntaxhighlighter" class="brush: ruby"&gt;
describe User do
   it { should validate_presence_of :name }
   it { should validate_format_of(:email).with('test@test.com') }
end

class User &lt; ActiveRecord::Base
  validate_presence_of :name
  validate_format_of :email, :with =&gt; /&lt;regexp&gt;/
end
&lt;/script&gt;&lt;p&gt;I don’t know about you, but this feels like a unnecessary duplication of effort. And this morning I just about had it. So I spiked some code and came up with &lt;a href="https://github.com/bcardarella/valid_attribute"&gt;valid_attribute&lt;/a&gt; The same validations from above would work like this:&lt;/p&gt;


&lt;script type="syntaxhighlighter" class="brush: ruby"&gt;
describe User do
   it { should have_valid(:name).when('Brian') }
   it { should_not have_valid(:name).when(nil, '') }
   it { should have_valid(:email).when('test@test.com', 'test+spam@gmail.com') }
   it { should_not have_valid(:email).when('bademail', 123) }
end

class User &lt; ActiveRecord::Base
  validate_presence_of :name
  validate_format_of :email, :with =&gt; /&lt;regexp&gt;/
end
&lt;/script&gt;&lt;p&gt;Now when comparing these two examples it might not be immediately obvious on the advantage of valid_attribute. But lets look at it from developing with BDD.&lt;/p&gt;&lt;p&gt;I want to create a Company model, and I’m going to test first. I’ll start by describing valid and invalid criteria. Then add the necessary validations to make the tests pass.&lt;/p&gt;

&lt;script type="syntaxhighlighter" class="brush: ruby"&gt;
describe Company do
  it { should have_valid(:password).when('test') }
  it { should_not have_valid(:password).when(nil, '') }
end

class Company &lt; ActiveRecord::Base
  validates_presence_of :password
end
&lt;/script&gt;&lt;p&gt;But now I need to add some more validations to the password attribute.&lt;/p&gt;
&lt;script type="syntaxhighlighter" class="brush: ruby"&gt;
describe Company do
  it { should have_valid(:password).when('123abc') }
  it { should_not have_valid(:password).when('password', '1a', nil, '') }
end

class Company &lt; ActiveRecord::Base
  validate_presence_of :password
  validate_length_of :password, :minimum =&gt; 6
  # Will only match strings that contain a number and a lowercase letter
  validate_format_of :password, :with =&gt; /\w*(?=\w*\d)(?=\w*[a-z])\w*/
&lt;/script&gt;&lt;p&gt;So we don’t add any more matchers, only update the acceptable values. When I am testing my models I care about asserting that certain data is valid and other data is invalid. valid_attribute makes this dead simple to do just that.&lt;/p&gt;
&lt;p&gt;I also do not think having a #.not_with method on the matcher makes any sense. RSpec already has &lt;a href="http://rubydoc.info/gems/rspec-expectations/2.5.0/Kernel#should_not-instance_method"&gt;should_not&lt;/a&gt;. And it should be used rather than passing false values to a matcher that expects to return true.&lt;/p&gt;</description><link>http://bcardarella.com/post/4355313471</link><guid>http://bcardarella.com/post/4355313471</guid><pubDate>Mon, 04 Apr 2011 22:02:00 -0400</pubDate></item><item><title>Client Side Validations 3.0</title><description>&lt;p&gt;&lt;a href="https://github.com/bcardarella/client_side_validations"&gt;client_side_validations on Github&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;The &lt;a href="https://github.com/bcardarella/client_side_validations"&gt;README&lt;/a&gt; and the &lt;a href="https://github.com/bcardarella/client_side_validations/wiki"&gt;Wiki&lt;/a&gt; are very detailed. Please check them out as well!&lt;/p&gt;

&lt;p&gt;&lt;a href="https://github.com/bcardarella/client_side_validations"&gt;Client Side Validations 3.0&lt;/a&gt; is out! Adding client side validations to an existing Rails 3 project is as simple as: (assuming you are already using jQuery &gt;= 1.4.1)&lt;/p&gt;

&lt;ol&gt;&lt;li&gt; requiring the gem…
&lt;pre class="brush: ruby"&gt;
  # Your Gemfile
  gem 'client_side_validations'
&lt;/pre&gt;&lt;br/&gt;&lt;/li&gt;

&lt;li&gt; running the install generator…
&lt;pre class="brush: plain"&gt;
rails g client_side_validations:install
&lt;/pre&gt;&lt;br/&gt;&lt;/li&gt;

&lt;li&gt; adding the &lt;b&gt;rails.validations.js&lt;/b&gt; javascript file to your layout
&lt;script type="syntaxhighlighter" class="brush: ruby"&gt;
&lt;%= javascript_include_tag 'jquery', 'rails', 'rails.validations' %&gt;
&lt;/script&gt;&lt;/li&gt;

&lt;li&gt; activating in a given form
&lt;script type="syntaxhighlighter" class="brush: ruby"&gt;
&lt;%= form_for @user, :validate =&gt; true do |u| -%&gt;
  &lt;%= u.label :name %&gt;
  &lt;%= u.text_field :name %&gt;
&lt;% end %&gt;
&lt;/script&gt;&lt;/li&gt;

&lt;p&gt;And it works! Wait… you don’t see anything?&lt;/p&gt;

&lt;p&gt;Okay, so by default &lt;b&gt;ActionView::Base.field_error_proc&lt;/b&gt; will wrap invalid fields with a ‘field_with_error’ class div. We need to extend this to also show the error message. The generator added &lt;b&gt;config/initializers/client_side_validations.rb&lt;/b&gt; You need to uncomment the &lt;b&gt;ActionView::Base.field_error_proc&lt;/b&gt; override. Now restart your rails app and presto-changeo you’ve got client side validations!&lt;/p&gt;

&lt;p&gt;If you’re using an alternate &lt;b&gt;FormBuilder&lt;/b&gt; like like &lt;a href="https://github.com/plataformatec/simple_form"&gt;SimpleForm&lt;/a&gt; or &lt;a href="https://github.com/justinfrench/formtastic"&gt;Formtastic&lt;/a&gt; you won’t need to uncomment anything. The error messages will render inline automatically.&lt;/p&gt;

&lt;p&gt;Let’s take a step back and look at the goals of this gem:&lt;/p&gt;

&lt;h5&gt;Project Goals&lt;/h5&gt;

&lt;ol class="postlist"&gt;&lt;li&gt;Follow the best practices for client side validations developed by
&lt;a href="http://www.alistapart.com/articles/inline-validation-in-web-forms/"&gt;Luke Wroblewski&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;Automatically extract and apply validation rules defined on the
server to the client.&lt;/li&gt;
&lt;li&gt;In the cases where a server-side validation rule would not work on
the client (i.e. conditional callbacks like :if, :unless) then do not
attempt client side validations. Fall back to the server side
validation.&lt;/li&gt;
&lt;li&gt;The client side validation error rendering should be
indistinguishable from the server side validation error rendering.&lt;/li&gt;
&lt;li&gt;Wide browser compliancy. I’ve tested with IE8, seems to work OK.&lt;/li&gt;
&lt;li&gt;Work with any ActiveModel::Validations based model&lt;/li&gt;
&lt;li&gt;Validate nested fields&lt;/li&gt;
&lt;li&gt;Support custom validations&lt;/li&gt;
&lt;li&gt;Support custom FormBuilders like &lt;a href="https://github.com/plataformatec/simple_form"&gt;SimpleForm&lt;/a&gt; and &lt;a href="https://github.com/justinfrench/formtastic"&gt;Formtastic&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;Client side validation callbacks&lt;/li&gt;
&lt;/ol&gt;&lt;p&gt;Breaking these down…&lt;/p&gt;
&lt;h5&gt;Follow the best practices for client side validations developed by &lt;a href="http://www.alistapart.com/articles/inline-validation-in-web-forms/"&gt;Luke Wroblewski&lt;/a&gt;&lt;/h5&gt;
&lt;p&gt;As Luke points out in his blog post Live Validations (or client side validations) are great for increasing conversion rates. He details how validating after a user exits a field yields the highest conversion rates (as well as the least confusion). Client Side Validations follows this philiosophy.&lt;/p&gt;

&lt;h5&gt;Automatically extract and apply validation rules defined on the server to the client&lt;/h5&gt;
&lt;p&gt;ActiveModel in Rails 3 allows us to reflect upon a given model’s validations. Client Side Validations takes advantage of this to package the rules and i18n messages for use on the client.&lt;/p&gt;

&lt;h5&gt;In the cases where a server-side validation rule would not work on
the client (i.e. conditional callbacks like :if, :unless) then do not
attempt client side validations. Fall back to the server side
validation&lt;/h5&gt;
&lt;p&gt;Some validations don’t make sense to attempt on the client. Instead of trying to get around this ClientSideValidations ignores these cases with the assumption the server will always be able to handle it better.&lt;/p&gt;

&lt;h5&gt;The client side validation error rendering should be
indistinguishable from the server side validation error rendering&lt;/h5&gt;
&lt;p&gt;Considering that we’re allowing some validations to pass to the server we need to ensure that how the errors render on a server side must match exactly how the errors render on the client side. To this end Client Side Validations uses the power of &lt;a href="http://jquery.com"&gt;jQuery&lt;/a&gt; to properly render the error for a given FormBuilder.&lt;/p&gt;

&lt;h5&gt;Wide browser compliancy. I’ve tested with IE8, seems to work OK&lt;/h5&gt;
&lt;p&gt;Pretty self-explanatory.&lt;/p&gt;

&lt;h5&gt;Work with any ActiveModel::Validations based model&lt;/h5&gt;
&lt;p&gt;As long as your model is using ActiveModel::Validations it should work. This includes ActiveRecord 3, Mongoid 2.0. MongoMapper is in the process of adopting ActiveModel.&lt;/p&gt;&lt;h5&gt;Validate nested fields&lt;/h5&gt;
&lt;p&gt;If your forms have nested fields via &lt;b&gt;field_for&lt;/b&gt; all validations should apply without any issue.&lt;/p&gt;

&lt;h5&gt;Support custom validations&lt;/h5&gt;
&lt;p&gt;If you write your own validations they are fully supported with just a small amount of code. &lt;a href="https://github.com/bcardarella/client_side_validations/wiki/Custom-Validators"&gt;The Wiki has a detailed guide on how to add custom validator support&lt;/a&gt;&lt;/p&gt;

&lt;h5&gt;Support custom FormBuilders like &lt;a href="https://github.com/plataformatec/simple_form"&gt;SimpleForm&lt;/a&gt; and &lt;a href="https://github.com/justinfrench/formtastic"&gt;Formtastic&lt;/a&gt;&lt;/h5&gt;
&lt;p&gt;Client Side Validations support SimpleForm and Formtastic. Most of the customization options should also be supported. Your own custom FormBuilder can be supported too, &lt;a href="https://github.com/bcardarella/client_side_validations/wiki"&gt;look out for a guide on the wiki soon.&lt;/a&gt;&lt;/p&gt;

&lt;h5&gt;Client side validation callbacks&lt;/h5&gt;
&lt;p&gt;Control the behavior of how the error messages appear or how a form handles failing validation with callbacks. &lt;a href="https://github.com/bcardarella/client_side_validations/wiki/Callbacks"&gt;The Wiki has a detailed guide on the callbacks&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;I hope people enjoy using this library. The re-write has taken a few months of my time and I’m happy to share the work with everybody. If you have any issues at all please don’t hesitate to open an &lt;a href="https://github.com/bcardarella/client_side_validations/issues"&gt;Issue on Github&lt;/a&gt; or contact me with any questions!&lt;/p&gt; &lt;/ol&gt;</description><link>http://bcardarella.com/post/4211204716</link><guid>http://bcardarella.com/post/4211204716</guid><pubDate>Wed, 30 Mar 2011 13:02:00 -0400</pubDate></item><item><title>Convert Prawn generated PDFs to an image with RMagick</title><description>&lt;p&gt;You’ll see some complaining from RMagick about how the Prawn generated PDF is not 100% up to Adobe standards but that can be ignored.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;&lt;br/&gt;
  pdf = Prawn::Document.new { text 'This is only a test.' }&lt;br/&gt;
  base64 = Base64.encode64(pdf.render)&lt;br/&gt;
  image = Magick::Image.read_inline(base64_pdf).first&lt;br/&gt;
  image.write('test.png')&lt;br/&gt;&lt;/code&gt;&lt;/p&gt;</description><link>http://bcardarella.com/post/1533991247</link><guid>http://bcardarella.com/post/1533991247</guid><pubDate>Wed, 10 Nov 2010 08:48:00 -0500</pubDate><category>Prawn</category><category>PDF</category><category>ruby</category><category>ImageMagick</category><category>Rmagick</category></item><item><title>Rails Camp New England #3</title><description>&lt;p&gt;Registration is open!&lt;/p&gt;

&lt;p&gt;When: Sept 10 - Sept 13&lt;br/&gt;
Where: Stowe, Vt Ski-Adventure Lodge &lt;a href="http://ski-adventure.com/"&gt;http://ski-adventure.com/&lt;/a&gt;&lt;br/&gt;
How much: $140 (+ eventbrite fees)&lt;br/&gt;
Why: Hacking and fun&lt;/p&gt;

&lt;p&gt;Join your other New England Rubyists for the 3rd Rails Camp New England!&lt;/p&gt;

&lt;p&gt;&lt;a href="http://rcne3.eventbrite.com"&gt;http://rcne3.eventbrite.com&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="http://railscamps.com"&gt;More information Rails Camp&lt;/a&gt;&lt;/p&gt;</description><link>http://bcardarella.com/post/866069849</link><guid>http://bcardarella.com/post/866069849</guid><pubDate>Tue, 27 Jul 2010 09:45:00 -0400</pubDate></item><item><title>remarkable_mongoid</title><description>&lt;p&gt;I just released &lt;a href="http://github.com/bcardarella/remarkable_mongoid"&gt;remarkable_mongoid&lt;/a&gt;. A set of Association and Validation RSpec matchers to use with &lt;a href="http://mongoid.org"&gt;Mongoid&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;Check out the &lt;a href="http://github.com/bcardarella/remarkable_mongoid/blob/master/README.markdown"&gt;README&lt;/a&gt; for instructions.&lt;/p&gt;
&lt;p&gt;Please note that this gem requires the 2.0 beta of Mongoid and installs the 4.0 alpha of Remarkable/ActiveModel. Despite their beta/alpha statuses I’ve been using both for over 2 weeks now and they feel very stable.&lt;/p&gt;</description><link>http://bcardarella.com/post/795087508</link><guid>http://bcardarella.com/post/795087508</guid><pubDate>Sat, 10 Jul 2010 17:43:00 -0400</pubDate></item><item><title>Rails Camp New England # 3</title><description>&lt;p&gt;The time has come to start planning for another &lt;a href="http://railscamps.com/"&gt;Rails Camp&lt;/a&gt; NE. Here are my thoughts on the next camp:&lt;/p&gt;

&lt;p&gt;Where: &lt;a href="http://en.wikipedia.org/wiki/Vermont"&gt;Vermont&lt;/a&gt;&lt;br/&gt;
When: Sometime After Labor Day (dependent upon scheduling a venue and other conflicting Ruby events)&lt;/p&gt;

&lt;p&gt;While &lt;a href="http://www.uri.edu/ajc/eec/"&gt;our last venue was fantastic&lt;/a&gt; it maybe have been too big for the size group that we attract. So I’d like to find a venue similar to the first RCNE (basically a large party house). Any help searching for a venue that people can give is much appreciated. Ideally I’d also like the prices to come back towards the $120/head that the first RCNE was instead of the ~$150/head. The best way to offset this is with sponsorship.&lt;/p&gt;

&lt;p&gt;I think the max size we’ll target is about 30 people. So if anybody plans on helping find a venue please keep that number in mind.&lt;/p&gt;

&lt;p&gt;Hopefully we can have a venue locked down pretty soon.&lt;/p&gt;</description><link>http://bcardarella.com/post/757623068</link><guid>http://bcardarella.com/post/757623068</guid><pubDate>Thu, 01 Jul 2010 09:30:00 -0400</pubDate></item><item><title>Custom Subdomains in Rails 3</title><description>&lt;p&gt;&lt;a href="http://yehudakatz.com/2009/12/26/the-rails-3-router-rack-it-up/"&gt;Rails 3 supports subdomains out of the box&lt;/a&gt;, which is great. But did you know that the constraints in the Router can actually match patterns too? This means instead of hardcoding each subdomain into your routes you can allow your customers to decide their own subdomains.&lt;/p&gt;

&lt;p&gt;However, we have to be careful with pattern matching on the subdomain. There are obvious subdomains we don’t want to match. Like ‘www’, ”, nil, and others that we may reserve. In this case using a pattern match might not be best.&lt;/p&gt;

&lt;p&gt;Thankfully the Rails 3 Router constraints can also take objects. As long as the object responds to Object.matches?. The request is passed to the method and you can act on it in any way. The following is the solution that I’ve found works for me.&lt;/p&gt;

&lt;p&gt;I created a ‘lib/sub_domain.rb’ with the following code:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;# lib/sub_domain.rb
class SubDomain
  def self.matches?(request)
    case request.subdomain
    when 'www', '', nil
      false
    else
      true
    end
  end
end
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;In my routes.rb file I can now wrap all routes I want under a custom subdomain&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;# config/routes.rb
TestApp::Application.routes.draw do |map|
  constraints(SubDomain) do
    root :to =&gt; "customers#index"
  end
  
  root :to =&gt; "home#index"
end
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Finally, I create a SubDomainController from which all controllers under the subdomain constraint can inherit from&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;# app/controllers/sub_domain_controller.rb
class SubDomainController &lt; ApplicationController
  before_filter :get_customer_from_subdomain
  
  private
  
  def get_customer_from_subdomain
    @customer = Customer.find_by_subdomain!(request.subdomain)
  end
end
&lt;/code&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;code&gt;# app/controllers/customers_controller.rb
class CustomersController &lt; SubDomainController
  def index
    ...
  end
end
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Having the SubDomainController is a nice way for me to encapsulate behavior that I want every subdomain to have. One such idea would be customer specific layouts. (or themes)&lt;/p&gt;

&lt;p&gt;Check out &lt;a href="http://www.therailworld.com/"&gt;Phil McClure’s&lt;/a&gt; post on &lt;a href="http://www.therailworld.com/posts/30-Issue-with-localhost-subdomains-in-Rails-3"&gt;localhost subdomains if you want to use this functionality in your development and test environments&lt;/a&gt;.

&lt;/p&gt;&lt;h3&gt;Update&lt;/h3&gt;
&lt;p&gt;To link to your dynamic subdomains you can completely overwrite the :host option in the url helper:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;root_url(nil, {:host =&gt; "subdomain.somedomain.com"})
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;This is not ideal. It constrains us to this particular domain. What we need is to be able to pass a :subdomain option to the url helper. (btw, you need to use the url helpers for linking to subdomains and not the path helpers)&lt;/p&gt;
&lt;p&gt;So I quickly wrote up this code. Just add it to your ApplicationController and it will be available to your entire app:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;class ApplicationController &lt; ActionController::Base
  ...

  private
  
  # To write subdomains on the url helpers:
  # root_url(nil, {:subdomain =&gt; "subdomain"})
  def url_for(options = nil)
    case options
    when Hash
      if subdomain = options.delete(:subdomain)
        if request.subdomain.empty?
          options[:host] = "#{subdomain}.#{request.host_with_port}"
        else
          options[:host] = request.host_with_port.sub(request.subdomain, subdomain)
        end
      end
    end
    super
  end
end
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;So now you can do:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;root_url(nil, {:subdomain =&gt; "subdomain"})
&lt;/code&gt;&lt;/pre&gt;</description><link>http://bcardarella.com/post/716951242</link><guid>http://bcardarella.com/post/716951242</guid><pubDate>Sat, 19 Jun 2010 23:13:00 -0400</pubDate><category>Rails 3</category><category>subdomains</category><category>Router</category></item><item><title>RVM Gemsets + Bundler == Awesome</title><description>&lt;p&gt;So I’m going to assume that you’re already familiar with &lt;a href="http://rvm.beginrescueend.com/"&gt;RVM&lt;/a&gt;, &lt;a href="http://rvm.beginrescueend.com/gemsets/"&gt;Gemsets&lt;/a&gt; and &lt;a href="http://gembundler.com/"&gt;Bundler&lt;/a&gt;. If you don’t know about them please follow the links and read up.&lt;/p&gt;
&lt;p&gt;Mixing RMV Gemsets and Bundler together is a kickass way to maintain environment isolation for your projects. First you want to create a &lt;a href="http://rvm.beginrescueend.com/workflow/rvmrc/"&gt;.rvmrc&lt;/a&gt; file in your project’s root directory. RVM will traverse up the directory structure until it finds a .rvmrc file and will use that.&lt;/p&gt;
&lt;p&gt;I usually just put the following into the file:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;rvm default@project_name&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;This will change to my default ruby and set the gemset to ‘project_name’. Then I create a Gemfile and put all of my library dependencies in there. Then run:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;&gt; bundle install&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Now I have a nice and isolated development environment. I can switch between multiple projects and always know that I won’t run into any versioning issues with the installed gems.&lt;/p&gt;
&lt;p&gt;One slight problem with this is if I’m including my .rvmrc file in my projects. Someone switches to it and get’s an error from RVM saying that the gemset doesn’t exist. Not that big a deal, they can go and create it. But it would be sweet if we could tell rvm to create the gemset if it doesn’t already exist.&lt;/p&gt;
&lt;p&gt;I pinged &lt;a href="http://www.beginrescueend.com/authors/2"&gt;Wayne Seguin&lt;/a&gt; (the guy that wrote RVM) about this and he suggested the following solution:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;rvm --create use default@project_name&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;tldr; RVM Gemsets  + Bundler == Awesome (and they kick ass)&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Update&lt;/strong&gt;:&lt;br/&gt;That last .rvmrc will keep printing out the ruby@gemset being used after every directory change. Kind of annoying. So just suppress the output:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;rvm --create use default@project_name &gt; /dev/null&lt;/code&gt;&lt;/pre&gt;</description><link>http://bcardarella.com/post/699582642</link><guid>http://bcardarella.com/post/699582642</guid><pubDate>Mon, 14 Jun 2010 23:02:00 -0400</pubDate><category>RVM</category><category>Bundler</category><category>Ruby</category><category>Gemsets</category></item><item><title>A cry for standardized versioning in Ruby (pretty please?)</title><description>&lt;p&gt;&lt;a target="_blank" href="http://semver.org/"&gt;Yesterday Rails 2.3.6 was released&lt;/a&gt;, &lt;a target="_blank" href="http://weblog.rubyonrails.org/2010/5/24/ruby-on-rails-2-3-7-released"&gt;today 2.3.7 was released&lt;/a&gt;. This morning the team I am on attempted to update our Rails 2.3.5 apps (we have several) to 2.3.7. It’s been several hours and we’re still not updated yet.&lt;/p&gt;
&lt;p&gt;When I see a version update of 2.3.5 to 2.3.6 as a developer I should be able to assume that the update is fairly marginal. In fact, in almost every case it should be a drop-in replacement. Historically hasn’t been the case with Rails.&lt;/p&gt;
&lt;p&gt;From a versioning point of view the significance in changes between 2.3.5 -&gt; 2.3.6 and 2.3.6 -&gt; 2.3.7 should be roughly equal. But as you can see &lt;a target="_blank" href="http://github.com/rails/rails/compare/v2.3.5...v2.3.6"&gt;here&lt;/a&gt; and &lt;a target="_blank" href="http://github.com/rails/rails/compare/v2.3.6...v2.3.7"&gt;here&lt;/a&gt; this is not the case. However, what I do know is that &lt;a target="_blank" href="http://weblog.rubyonrails.org/2009/11/30/ruby-on-rails-2-3-5-released"&gt;2.3.5 was released on Nov 30, 2009&lt;/a&gt;. &lt;a target="_blank" href="http://weblog.rubyonrails.org/2010/5/23/ruby-on-rails-2-3-6-released"&gt;2.3.6 was released on May 23, 2010&lt;/a&gt;. &lt;a target="_blank" href="http://weblog.rubyonrails.org/2010/5/24/ruby-on-rails-2-3-7-released"&gt;2.3.7 was released on May 24, 2010&lt;/a&gt;. Perhaps time is the best metric? In that case would it make sense to adopt something similar to the &lt;a target="_blank" href="http://en.wikipedia.org/wiki/Software_versioning#Date"&gt;Ubuntu versioning scheme&lt;/a&gt;? (Year.Month.Day.patch)&lt;/p&gt;
&lt;p&gt;Rails aside, poor version management is systemic in the Ruby community. Despite pushing for code perfection in every other sense the Ruby community as a whole has entirely ignored proper versioning. If we are to be taken seriously by the development community at large our versioned releases must have meaning behind them.&lt;/p&gt;
&lt;p&gt;&lt;a target="_blank" href="http://semver.org/"&gt;Semantic Versioning&lt;/a&gt; seems to be the most logical approach to me. It would be nice to see a community movement towards this, or some versioning standard. Rails 3.0 would be a great starting point to push for a versioning standard in the Ruby community.&lt;/p&gt;</description><link>http://bcardarella.com/post/628870702</link><guid>http://bcardarella.com/post/628870702</guid><pubDate>Mon, 24 May 2010 15:39:08 -0400</pubDate><category>Ruby on Rails</category><category>2.3.5</category><category>2.3.6</category><category>2.3.7</category><category>3.0</category><category>semantic versioning</category><category>software versioning</category></item><item><title>Moved from Blogspot to Tumblr</title><description>&lt;p&gt;The move was incredibly easy thanks to this tool:&lt;/p&gt;
&lt;p&gt;&lt;a target="_self" href="http://terrymhung.com/jtran/tumblr/import-blogger-to-tumblr.php"&gt;&lt;a href="http://terrymhung.com/jtran/tumblr/import-blogger-to-tumblr.php"&gt;http://terrymhung.com/jtran/tumblr/import-blogger-to-tumblr.php&lt;/a&gt;&lt;/a&gt;&lt;/p&gt;</description><link>http://bcardarella.com/post/584244139</link><guid>http://bcardarella.com/post/584244139</guid><pubDate>Sun, 09 May 2010 11:43:18 -0400</pubDate></item></channel></rss>

