rubyonrails

Move to Rails 2.0.2

I finally moved Muziboo to rails 2.0.2 this weekend. The move went pretty smooth. The only gotcha for me was that counters used with conter_cache  are marked as readonly in rails 2.0.2 so you cannot use update_attributes to update them (in a migration or otherwise)
The trick is to use Class.update_counters class method …
Other than that […]

Popularity: 10% [?]

Rails : Accessing session data in models

MVC architecture is good for keeping your design neat but once in a while you hit a road block and this is one such situtation.  If you want to log actions/events in your code and track changes to models, you would want to do that in the activerecord callback hooks like after_save and before_destroy. However […]

Popularity: 17% [?]

ruby’s respond_to? for checking if a method exists

Ruby has a function called respond_to? that can be used to seeing if a particular class or object has a method with a certain name. The syntax is something like

User.respond_to?(’name’) # returns true is method name exists otherwise false

This came in very handy the other day when I wanted to send emails in muziboo […]

Popularity: 42% [?]

Rubyworks on Debian Etch

I recently got a new VPS account and it runs 64 bit Debain Etch (4.0). I installed rubyworks on it and the installation went pretty smooth. After that, I tried to move muziboo.com files to this server and a lot of error started happening in trying to get the app up.
First one was

muziboo@debian:~/muziboo/muz$ rake db:migrate
(in […]

Popularity: 23% [?]

Ruby on rails learning curve!

The post should be called my ruby on rails learning curve. I just wanted to write about what it was for a person like me to learn ruby on rails and get productive in it and make something like Muziboo.com
I was introduced to rails by a cousin of mine when I was trying to decide […]

Popularity: 21% [?]

counter_cache gotcha in activerecord!

If you are using counter_cache, you must watch out for this one. I am not sure if this has been fixed in the recent version, but the version that I am using (1.15.3) has the issue
If you are using counter_cache (such as in acts_as_commentable as described here), you must make sure that after updating the […]

Popularity: 11% [?]

Active record validation with mongrel_upload_progress

The active record validation is finally working with mongrel_upload_progress … yayee. To read more about what the issue was, follow this post
I will try to explain my setup and then the solution to the problem
I am trying to watch /song/upload with mongrel_upload_progress plugin. Inside /song/upload, I save the song if the validation passes (such as […]

Popularity: 14% [?]

Ruby issues and backgroundrb

Well on a fine saturday morning, i set a breakpoint in my code so that I can read the values of params being passed on a form submit (i wanted to try checkbox arrays) and I get an error saying breakpoints not supported in ruby-1.8.5. I had installed ruby sometime back on my ubuntu […]

Popularity: 14% [?]

Active record and Mongrel Upload Progress Plugin

Muziboo is a pretty upload intensive website. Also there is the issue of resampling the MP3 file so that the flash player plays it well (Frequencies not multiple of 11025 Hz are ‘chipmunked’ in flash). I started looking into the mongrel_upload_progress plugin yesterday and found this demo to get me started. It works […]

Popularity: 14% [?]

Tag clouds with acts_as_taggable for different Taggable Types

So you are building a cool new web 2.0 startup and want to have the cool tagging feature. If you are using ruby on rails, you can use Acts_As_Taggable Plugin . There is a neat way to build a tag cloud explained here.
Now acts_as_taggable uses a field called taggable_type to know what object this tag […]

Popularity: 16% [?]