I recently just got the 24inch iMac and had to undergo the massive task of porting over everything from my MacBookPro. This included installing all the needed custom installs of Ruby, Rails, ImageMagick, RMagick, MySQL and configuring everything to work properly. I had the most trouble with ImageMagick, although it wasn’t that hard It still took me a bit to do. Now I hate mac ports, well I don’t hate but I don’t like how it install stuff everywhere. I like being able to control what’s being installed in a tidy fashion. So this is what I did to get ImageMagick working:
Advanced Rails Recipes – Keeping Forms Dry and Flexible – Plugin
I’ve updated the previous patch of ElevatedFormBuilder to a Ruby on Rails plugin. You can now install it as a plugin from my github:
script/plugin install git://github.com/darrenterhune/elevated_form_builder.git
If anyone has any problems just add comments below.
Formtastic is far superior than this plugin so you should check that out instead.
Advanced Rails Recipes – Keeping Forms Dry and Flexible Patch
Update: This patch can now be installed as a rails plugin from my github.
I recently committed a patch for the “Keeping Forms Dry and Flexible” recipe found in Advanced Rails Recipes Book. The original recipe was written by Mike Mangino of Elevated Rails. The first time I used the recipe found in the book, I was pretty impressed… almost. Being a usability and accessibility freak that I am I saw that if you passed in the custom :label option (This is to print a custom label instead of the default table column name, which would be in this case… “Title”):
<%= f.text_field :title, :label => "custom label here" %>
This would print:
<label for="controller_title">Custom label here</label><input id="controller_title" type="text" value="some value here" size="30" name="controller[title]" label="custom label here"/>
Wha? There’s a label param in the input element? That’s not allowed!. So I went off to Mike’s website and contacted him asking him if he had any updates to this recipe. He gladly created a new repository on github for me to pull from. I grabbed his new version of the error_handling_form_builder. Wow it’s different! Wow it’s got 2 form builders! One that lets you use templates like in the book and a more customizable one, that just uses content_tag methods to build a form. Both are pretty sweet and both use the same helper method. However when I tested, it still printed the label in the input. So I did a patch and Mike did a patch and now we have a dry, flexible, accessible, usable and badass form builder with 2 options for building forms! Or of course from Mike’s github.
RubyProf error “can’t convert Fixnum into String”
I recently maxxxxed out my memory limit on my regular dreamhost account at work causing 500 errors all over the place. This is now forcing me to start learning how to cache, and trace my apps for memory and performance. I also switched to PS with 300mb burstable to around 700mb. That should help out for now. Anyway, back to finding out which requests are drinking redbull… I installed the ruby-prof gem to find out. I ran a request with the param key added to the end of the url and wham! Errors? WTF? I copied the code right out of “Advanced Rails Recipes” correctly, and checked it 10 times? So what’s the error? “can’t convert Fixnum into String”? Well it seems that the printer class is trying to convert a number to a string:
response.body << printer.print("", 0)
Just change that to this and that:
response.body << printer.print("", '0')
Then it worked out fine! Hope that helps someone out cause I spent about 2 hours searching for the problem.
Modifying Textmate drawer font size
New builds of textmate come with the ability to change the font size! See @Allan’s comment below for details.
Download the intel based test build by option clicking the check now button in TextMate’s system preferences software update tab.
$ defaults write com.macromates.textmate OakProjectDrawerFontSize -int 15
If you are like me and hate how small the font’s are in Textmates drawer, don’t get mad get modificlisious. You must have Xcode installed. Don’t worry about messing around with Interface builder files for apps because when you save the nibs they save a backup. Here’s how to modify the font size in Textmates drawer:
- Browse to the application and right click or ctrl click => show package content
- Go Contents/Resources/English.lproj/ => open Project.nib
- In the project window double click on the FileHierarchy icon
- Now the FileHierarchy window should open so click on the drawer in the FileHierarchy window
- Press Apple T or go Format => show fonts from the menu set
- Now just select the font you want to use and the size
- You should see the fonts change
- Save and relaunch Textmate!










Backseat Drivers