Smorgasbord - Politics, Lisp, Rails, Fencing, etc.

My musings on assortment of things ranging from politics, computer technology and programming to sports.

Wednesday, March 22, 2006

On this day:

Some good news

I am leaving for Amritsar today, to participate in the National fencing competition. Since, I don’t have much of fencing experience behind me, the expectations are not very high, but I will give it my best shot and aim for the best possible result.

Thursday, March 09, 2006

Rails User Engine - Adding permissions

My preferred way of doing this is using migrations. I will illustrate it here using an example, say we have a controller about with actions ["terms", "privacy", "faq", "about"] and we want to give permissions to both Guest and User roles to have access to this.

So, to write a migration for this, fire up a shell and type:

ruby script\generate migration AddPermissionsData

This will create a new migration file in the `db\migrate' folder:

class AddPermissionsData < ActiveRecord::Migration def self.up end

def self.down endend

Now, to add permissions modify the above file, and add the following code:

the deal could make the world more dangerous: Even if India is a responsible player, the deal could touch off a regional race to produce more bomb fuel. In that case, more of that fuel would be floating around Â perhaps to tempt terrorists.

On a more positive note:

India shows restraint and Mr. Bush's gamble pays off, other nations that defiantly built their own weapons may gradually be drawn back into a new club whose membership rules are still being written.

Many people must be wondering why such protests needlessly turn violent and hurt the local civilians and property. Rarely ever is the offending party anywhere near the scene of protest, so what end can be achieved by needless violence and self-destruction.

Well the truth is (at least in India, and I can imagine quite likely in Pakistan, Nigeria and other developing nations) the people who participate in these rallies are rarely genuinely concerned about the issue at stake. Even if occasionally they do sympathize with the issue, nevertheless they participate in these rallies only for monetary benefits.

These protests are generally organized by local politicians or pseudo-religious leaders and they pay the participants wages for taking part in the rallies. The poor people who go to these protests are most often well aware that there will be some violence but still the lure of easy money is strong enough to overcome the fear. The leaders then hire some goons and miscreants to cause violence, because generally the success of the protest is gaged by the amount of violence and destruction it causes, besides it also helps in getting coverage in local and international news.