Archive for the ‘rubyonrails’ Category

Move to Rails 2.0.2

February 23rd, 2008 by Prateek Dayal View Comments

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 [...]

Popularity: 7% [?]

Rails : Accessing session data in models

October 25th, 2007 by Prateek Dayal View Comments

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: 12% [?]

ruby’s respond_to? for checking if a method exists

October 16th, 2007 by Prateek Dayal View Comments

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 [...]

Popularity: 81% [?]

Rubyworks on Debian Etch

October 13th, 2007 by Prateek Dayal View Comments

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$ [...]

Popularity: 13% [?]

Ruby on rails learning curve!

August 23rd, 2007 by Prateek Dayal View Comments

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 [...]

Popularity: 19% [?]

counter_cache gotcha in activerecord!

August 19th, 2007 by Prateek Dayal View Comments

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 [...]

Popularity: 9% [?]

Active record validation with mongrel_upload_progress

August 19th, 2007 by Prateek Dayal View Comments

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 [...]

Popularity: 10% [?]

Ruby issues and backgroundrb

July 29th, 2007 by Prateek Dayal View Comments

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 fiesty [...]

Popularity: 8% [?]

Active record and Mongrel Upload Progress Plugin

July 24th, 2007 by Prateek Dayal View Comments

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 fine and [...]

Popularity: 10% [?]

Tag clouds with acts_as_taggable for different Taggable Types

July 22nd, 2007 by Prateek Dayal View Comments

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 [...]

Popularity: 12% [?]