Things that suck about your MacBook Pro that no one will tell you about

I have a Core Duo model and am running windows (w/ bootcamp), so some of this stuff probably doesn’t apply but …

1. The hard drive is painfully slow. When you go to delete something, you can sit there for a good 5 seconds before the delete dialog is gone

2. You can only run an external 2.5 inch hard drive off one particular USB port (the one to the right) … if you put it on any other port, it will not get enough power and be stuck powering up then powering down. Or it will power up and stay fine for a bit, until it suddenly starts experiencing the situation I’ve described.

3. Maximum installable RAM … 2 Gigabytes.
god.

4. While you can get up to 4 hours of power running OS X on the battery … you’ll barely get 2 hours running Windows.

note: This is a late night rant … I love my darling MacBook Pro.

Ruby on Rails gotcha: undefined method `rewrite’ for ….

undefined method `rewrite' for "":String

If you get this error, and the error message is pointing you to a “link_to” call or something similar, then you may be using an instance variable that’s called ‘@url’ too.

This blog post did talk about the problem but it seemed limited to models only. I finally discovered that, in my case, I was using ‘@url’ in the controller for the view where I was making the ‘link_to’ call.

Long story short, if you see this error, comb through your code (models, controllers and views) for any variables that are called ‘@url’  and change them.

Dreamhost now supports mod_rails on their shared hosting plans

Dreamhost now supports the use of mod_rails on their shared hosting plans

The Phusion team contacted me with a working test version of Passenger a couple of months ago and since then DreamHost has been helping out with testing and ironing out lingering deployment issues.  The Phusion team has been very helpful and responsive throughout the process and I think we will see a lot more great things from them in the future.

Now to the important part… how do you use Passenger on DreamHost?

Briefly, all you do is enable the Ruby on Rails Passenger (mod_rails) option for any existing or new web domain in the DreamHost web control panel. When you then point that domain’s web directory to the public directory of an existing Ruby on Rails application it will work automatically.  For more detailed information, check out our Passenger wiki page.

php’s print_r equivalent in ruby on rails

I was going through my google analytics logs today and I noticed that a lot of folks were coming to my site on Google searches for stuff like ‘print_r + ruby on rails‘.

So I figured I’d write a blog post about it, because I’ve had the same problem.

What you’re looking for is ‘inspect’.

If you have an array, hash or object that you want to take a quick-and-dirty look at just type in

objectname.inspect

eg:

posts.inspect

or if you’re in rails just do …

render :text => posts.inspect and return false

and you’ll get an output of the contents of said array, hash or object.

Here is a screen capture of a quick irb session to show you how it works.

print_r equivalent in ruby on rails

I hope this helps.