November 2007
12 posts
How to not accidentally send thousands of 'beta...
So you’re building a sweet new web 2.0 app and you need an exclusive pre-launch beta test. It’s gotta be wicked pretentious and exclusive. I don’t know, maybe you’ve spent too much time on the west coast and are disconnected from the realities of the world. Alternately, you’ve already launched a site and your staging environment server is regularly getting dumps of production data to simulate...
Shoulda gets all sparkly
The Shoulda testing plugin has been getting some love lately. Read on to see what we’ve done.
Stripped down Gem
The core components of Shoulda have been moved into their own gem. This pretty much just includes the context and should blocks, letting you do things like this:
context "a plain old ruby program" do
setup { ... }
should "be able to use the shoulda gem" do
...
...
4 tags
One Laptop Per Child
After three years of discussion and controversy, the One Laptop Per Child project is finally selling real laptops for real children. They’re $200, and right now they’re running a promotion called Give 1, Get 1, where you can pay for two laptops; one gets sent to a child in need somewhere in the world, and one gets sent to you! It plays right into us Americans’ psyche—we get to satisfy our...
totally classless
Recently I had a requirement on an app that had 2 types of groups.
public
private
Anyone can join a public group.
However to join a private group you have to be registered on the private group’s website, e.g. pretend Yahoo is a private group, now in order to join the Yahoo group you have to have an account with Yahoo.
Let’s pretend that every private group’s website implements a...
The URL Police
I think we can all agree that seeing a form (like search, for example) which is going to send a message in a bottle, or even as part of a GET request should not include that dirtiest of url params — “commit=Submit” or “commit=Go”.
When you send your SOS to the world, you want it be to be nice and clean, don’t you? I mean, if a year has passed since you wrote your note…well, it’s time...
the contest
So here at thoughtbot we’re really proud of the two company founders, Chad and Jon , for finishing up their first book: Pro Active Record: Databases with Ruby and Rails. To celebrate the publication of the book, we’re going to have a contest where we’ll be giving away some copies of the book, and maybe we’ll throw in some other sweet thoughtbot swag.
Master of your domain model
We...
yeah its ok
Here’s a SessionController#create action that supports the classic ‘remember me’ functionality of login forms.
def create
@user = User.authenticate params[:email], params[:password]
if @user.nil?
flash.now[:notice] = 'Invalid email and/or passowrd'
render :action => :new
else
if remember_me?
@user.remember_me!
cookies[:token] = {
:value =>...
Book Review: Troubleshooting Ruby Processes by...
Addison-Wesley has been releasing a number of Ruby and Rails books under the editorship of Obie Fernandez. I got my hands on Troubleshooting Ruby Processes by Philippe Hanrigou, and I have to say that I was very impressed with the material presented.
To put my views in perspective: While I have only spent the last year as a professional Rails programmer, I spent around 6 years before...
4 tags
RubyConf 2007 Day 3
As expected, Day 3 is a lot more low energy, with less adventure and more audience members with headaches. People are stumbling into the talks anyway, and RubyConf wisely decided to jumpstart people’s day with Dr. Nic.
“It was a complete prick of a thing to work with. Can you say that in this country?”
—Dr. Nic Williams
“A” For Australia
Dr. Nic Williams is presenting on “Use Ruby to...
4 tags
RubyConf 2007 Day 2
It’s Day 2 at RubyConf. Many people had very late nights yesterday, and the excitement is just a little dimmer than yesterday morning. I’m making it down just barely in time for the opening talk of this morning’s gauntlet of alternative implementations of Ruby.
Iron Ruby
John Lam is presenting on the “State of IronRuby”. It’s 9am on the 2nd day of the conference, and it’s Microsoft...
1 tag
RubyConf 2007 Day 1
Welcome to RubyConf
Me, Tammer, and Dan are all here at the OMNI CHARLOTTE Hotel, at RubyConf 2007. This is my post, written throughout the day, so be prepared for some crazy tense switching.
Marcel Molina is launching RubyConf with the first talk, about what makes software beautiful. He’s bringing in a lot of linguistics and mathematics and physics concepts, and is sure to remind...
testing your tests
Recently I was taking a look at my tests and noticed some things. I’ve been writing tests for my tests without knowing it.
Here’s one I commonly do when testing the ordering of results from an ActiveRecord class side finder.
This is wrong:
def test_should_find_all_posts_ordered_by_most_recent_first_when_sent_recent
posts = Post.recent
posts.each_with_index do |each, index|
if...