Category Archives: Ruby

Post navigation

We were developing a Content Management System which is composed of different components, with each component having dependency on other components in the hierarchy. Our CMS has the following structure : Site has_many pages Page has_many sections Section has_many embedded_modules … Continue reading →

May be you guys have noticed that when you try to install a new gem on your machine it says some thing like “Updating meta data for 500 gems” and display one dot per gem. These dots moves very slowly and stops in some time.
I faced this situation many times and found a solution […] Continue reading →

The ruby is getting changed and improved a lot with every release. No doubt the existing demerits of rails are soon going to be history.
Currently for my rails applications I am running Ruby1.8… and exploring 1.9 to get ready as we are heading with nice speed in the rails developments. Modrails has already started making […] Continue reading →

Ok, so we had been shouting ourselves hoarse, claiming that Rails is all about developer productivity and joy. So is that all about it?, huh!, was the normal reaction. But isn’t that a big enough reason. Not for many people though.
Yes, we accept that there are some pain points, like hosting Rails applications at shared […] Continue reading →

I have been using “Annotate Models” rails plugin written by Dave Thomas since I found it around one and half year ago. It really helps while writing fixtures. But if you use RSpec you might miss schema info at the top of your rspec fixture file as I do. So, today I modify the plugin […] Continue reading →

Ruby 1.9 provides the block scoping of the local variables. It shadows the outside local variable in the block and allocates a new object_id in the memory to the block variable, which essentially means much more flexibility in using the lambdas without worrying about the name of the block variable. Remember that instance, class and […] Continue reading →

If you have installed ruby using apt-get or if you have not mentioned the configuration option for openssl while installing from source, you can expect openssl will not work with ruby.
Here is the solution for the same…
Step 1
Install gcc and make(if you don’t have already on your box)

You may have noticed by now, that in Rails 2.0 changeset 7422, you can specify columns you want to add/remove in your migration by passing attribute:type pairs to the migration generator.
For example, lets assume that we need to add a column ‘role’ in users table(User model). In this case generate a migration like:

Some days ago I wrote a post about “SVN commit notification” which uses a perl script for sending commit notification with svn diff by mail. In this mail you can find svn diff from the last committed revision. I used to love this mail, soon I realized that it is a bit ugly and difficult […] Continue reading →

The function(s) defined within a function works fine with any hierarchy only within the main object but gives NoMethodError inside a class.
Lets exemplify it!
Here are the example of both main object and inside a class…