Blog (ruby)

@fredwu 14 years ago | 1 min read | no comments
Before (Rails 3.0.1pre stable branch + Arel 1.0.1): [] After (Rails 3.1.0 master branch + Arel 2.0.0dev master branch: [] Thanks to the awesome work done by Aaron Patterson (@tenderlove) and others. :-) UPDATE: After Aaron Patteron’s tweet, I ran the tests again on Rails 3.0.1pre stable branch + Arel 2.0.0dev master branch, and the result blew my mind: []
@fredwu 14 years ago | 1 min read | no comments
Don’t you just hate it when you get the following errors during a Capistrano deployment? bundle: command not found Could not find RubyGem bundler (>= 0) (Gem::LoadError) In fact, even if you don’t use bundler, you might still get errors like this: rake: command not found Could not find RubyGem rake (>= 0) (Gem::LoadError) It turns out this has something to do with the $PATH and $GEM_HOME variables. So here’s the quick fix. Log in to your deployment server, as a root us...
@fredwu 14 years ago | 1 min read | no comments
If you haven’t already been using AppConfig in your Rails project, well, you should! Jacques Crocker has recently released his new version of the original AppConfig - RailsConfig. I was invited to join the development of this new tool, so make sure you go check it out. :-)
@fredwu 14 years ago | 1 min read | no comments
I have just pushed a commit that added Rails 2.x compatibility to Inherited Resources Views. Please give it a spin! :-) P.S. I’ve only tested it on Rails 2.3.8.
@fredwu 14 years ago | 1 min read | no comments
Using Inherited Resources is an excellent way to reduce the amount of repetition in your controllers. But what about views? A lot of times resources share the same views, so why not DRY ‘em up using Inherited Resources Views! Go check out the code! :-)
@fredwu 14 years ago | 1 min read | no comments
[] Released my first ruby gem. :-)
@fredwu 14 years ago | 1 min read | no comments
I am extremely happy that my patch was accepted, so I am now one of the 1600 odd people who have contributed to the Rails project! :D
@fredwu 14 years ago | 1 min read | no comments
Introduction ActiveRecord is without doubt the de facto ORM library for Rails and many Ruby web frameworks. Many developers however, do not like database migrations and prefer to use DSL for data mapping. Datamappify is created with the sole purpose of getting rid of the DB migration headaches. Why Not DB Migrations? Well, depending on your specific project, DB migrations might create more trouble than it’s worth. Besides, your code is already version controlled, so why create a separate versi...
@fredwu 14 years ago | 1 min read | no comments
A few days ago I discovered Padrino, an excellent ruby framework built on top of Sinatra. What can be a better than experimenting with it? Build an actual website with it! So last night I ported Wuit.com from using vanilla PHP + Flourish to using Padrino + DataMapper + Haml. The entire porting experience was positive, albeit the website only has two pages. I did encounter a strange problem with Capistrano though - both current_release and latest_release were giving me strange results. In the e...
@fredwu 14 years ago | 3 min read | no comments
The Rails deployment flow is really smooth thanks to the powerful (and easy to use) Capistrano. Capistrano not only works with Rails and other Ruby code bases, but also code bases in any programming languages, such as PHP! Here is an overview of what I did to get one of our PHP production sites up and running with Capistrano. If you don’t already have Ruby and Rubygems installed, install them! After you got ruby and rubygems, install Capistrano and its related gems - gem install capistra...