Pardel’s Blog

crushed by equilibrium

Archive for November, 2006

Another Rails trick - Disable update

Scenario:
A table/model needs to be read-only for still allowing records to be added
Solution:
Add the following in the model

def before_update
return false
end

My life on Mac

The last couple of days were fantastic. Slowly, I’m migrating all my files to the new machine.
There are plenty of tutorials around and nothing is too complicated although I believe that a proper Mac user should have a IT background. Otherwise, one can only scratch the surface in terms of functionality.
Last night I’ve imported all my music, including the 4G worth of podcasts and all my images (about 4000 of them). I think I have only 10G or so left. :)

Got my new MacBook today

I had the pleasant surprise to receive my new MacBook today, 5 days before the estimated delivery time. It was definitely long waited. :)
After spending couple of hours and downloading about 3Gb of software (including Xcode) I got everything pretty much up to speed. Will be nice to see if I manage to install packages to replicate the functionality of my Toshiba.
So far, I’ve managed to install Firefox (hence I’m writing this from the Mac), ruby, Ruby on Rails and Mysql.
I’ll keep you posted.

Another Rails trick - Migration

Here is another under-documented or rather undocumented feature: on migration scripts you can use size for an integer.

t.column :login_tries, :integer, :limit => 2, :null => false

Another Rails trick - Route with an arbitrary number of parameters

Flexable Routes With: *path_info: click here.

Older entries »