When using Rails, you’re using migrations a lot. Migrations are awesome. But today I ran into a problem. I had to convert a column to be of type :boolean ( it was of type :text ). I was suprised when things went wrong.
Continue reading
Category Archives: Ruby On Rails
How to PUT xml to a REST interface with Basic Authentication
Well, this thing got me going for a couple of hours before things worked out. Using HTTPService did not seem to be the way to go. Long story short: URLRequest to the rescue!

Usefull Rails log visualizer with Adobe Air
Just found this potentially usefull tool to analyse your Rails logs visually. It handles drag ‘n drop and has some pie charts in it.
Lib Tip: Deploying Rails Applications
This is an amazing book. Not only does it handle what it says on the cover, but it also touches advanced use of SVN, common security issues with Rails and so on. 5 out of 5 stars!
Rails howto: custom value field in collection_select
Very easy this one:
Contact.rb ( Model )
...
def name_and_company
@name_and_company = name + " - " + contact.company.name
end
...
Usage ( note the use of :name_and_company )
<%= form.collection_select(:contact_id, @contacts, :id, :name_and_company ) %>
The story of compound keys
Short story: I needed a table that could visualize the relation between two other tables ( services & portfolio ). So I set up a “join table”; a table that has two columns: service_id and portfolio_id. Each column contains a foreign key ( services.id and portfolio.id ).
Now, what you normally do is add a third column “id” as primary key. But in this case it can be a recipe for ( a programmer’s ) disaster. The column id would always contain a unique value, but the combination of the two other columns service_id and portfolio_id will not be unique. And thus you could run into a situation where you have multiple rows that hold the same relation:
NetBeans 6.0 bèta ( with Ruby on Rails support! )
Title says it all
Another one to add to the pile that is “Ruby on Rails editors”.
Netbeans 6.0 bèta pages

