Archive for the 'RubyonRails' Category

I have been using Git from last few days, and faced following errors while committing:
1) Trailing whitespace
2) Indent SP followed by a TAB
3) Unresolved merge conflict
The first error “Trailing whitespace” is because of carriage-return/line-feed(windows style line feed/end). To resolve this problem comment following lines(58-60) in .git/hooks/pre-commit file:

if (/\s$/) {
bad_line(”trailing […]

Wednesday, April 23rd, 2008 | No Comments

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

Wednesday, April 23rd, 2008 | No Comments

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:

script/generate migration […]

Wednesday, January 23rd, 2008 | No Comments

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

Monday, January 14th, 2008 | 1 Comment

The view helper method capture provides this functionality to wrap a section of the view template in a variable and can be used multiple times in the view.
Usage :

You can earn a lot, if you use your brain!
to know more!

Advantage:
If its needed to render a section of template code, we […]

Friday, January 11th, 2008 | No Comments