Akhil Bansal

This user hasn't shared any biographical information


Posts by Akhil Bansal

Hoptoad: A Rails Exception Handling Service

August 12, 2008 - 4:01 pm

Tags: , , , ,
Posted in Exception, Hoptoad, ROR, Rails, Rubyonrails, hosting, notifications, ruby | No comments

Many of you guys(as me) may have used Exception Notifier plugin to get Rails app exceptions right into your mailbox, and may also have faced some problem like this.
Also if you have 2-3 or more apps running in production then managing such exception mails is also a big headache. In such case one have to [...]

Configuring TinyMCE SpellChecker with rails application

August 8, 2008 - 5:44 pm

Tags: , , , , , ,
Posted in Rails, aspell, editor, ruby, spelling, tinyMCE | 2 comments

Last month I spent much time while configuring tinymce’s spellchecker with my rails application. But finally I got it working and thought I could be a good post. To configure this I took some help form gusto’s blog and google (as usual). So, Lets do it now without spending more time.
First of all create a [...]

Hosting Rails app and Wordpress on same domain(as folder instead of subdomain)

August 8, 2008 - 2:05 pm

Tags: , , , , , ,
Posted in Rails, SEO, apache, hosting, wordpress | 6 comments

Hey guys, Yesterday I did an interesting server configuration. Actually we had a rails app hosted on server which is using passenger(a.k.a mod_rails). This application can be access by going to http://domain.com . Also we had a wordpress running which could be access by going to http://blog.domain.com.
But, for SEO sake I had to change configuration [...]

Leopard sucks while installing/updating gems

August 7, 2008 - 5:17 pm

Tags: , , ,
Posted in gem, leopard, ruby | No comments

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

When Ultrasphinx is used with polymorphic associations…

August 7, 2008 - 2:26 pm

Tags: , , , , , , , ,
Posted in ROR, Rails, Rubyonrails, Ultrasphinx, associations, full text search, polymorphism, ruby, sphinx | No comments

Lets first consider simple has_many and belongs_to associations as:

class Article < ActiveRecord::Base
has_many :comments
end

class Comment < ActiveRecord::Base
belongs_to :article
end

Now if you wish to index the title of associated article with comment for searching, you just need to add ” is_indexed :fields => :body, :include => [{ :association_name => 'article', :field => 'title', :as=> [...]

When Ultrasphinx is used with STI…

July 31, 2008 - 7:36 pm

Tags: , , , , , , ,
Posted in Rails, STI, Ultrasphinx, full text search, ruby, sphinx | No comments

Hi Guys, it has been a long time since I last posted. I had worked on several things since then, and have couple of posts pending/draft. One of those posts is related to Ultrasphinx, when it is used with STI models.
For those who are new to Ultrasphinx: Ultrasphinx is a rails plugin and client to [...]

Git Error: trailing whitespace, indent SP followed by a TAB, unresolved merge conflict

April 23, 2008 - 11:49 pm

Tags: , ,
Posted in git, scm, vcs | 6 comments

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

Rails Plugin Annotate Models For Spec And Spec Fixtures

April 23, 2008 - 4:48 pm

Posted in ROR, Rails, Rubyonrails, rails_plugin | 1 comment

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

Git – Fast Version Control System

February 15, 2008 - 12:41 am

Posted in git, scm, vcs | 3 comments

Git is getting popular in Rails community these days, as there were being many changes in rails to support Git.
Git is a open sourse fast version controller system. It was originally designed by Linus Torvalds to handle large projects. It was inspired by Monotone & BitKeeper. It is a distributed version controlling system. It gives [...]

Migration: Adding/Removing columns are now much easier

January 23, 2008 - 10:54 pm

Posted in ROR, Rails, Rubyonrails, migration, ruby | 7 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 AddRoleToUser [...]