gem

Using Amazon SimpleDB with Rails

Last week I tried to use simpleDB with rails, here are some slides I prepared:

Skiping installation of ri and RDoc documentation while installing gems

Probably most of the time you would like to skip ri and RDoc installation while installing some new gems, specially on production server.

I do like to skip ri and RDoc documentation while installing gems on my development machine, because it takes more time to generate ri and RDoc then actual installation of gem.

We can skip rdoc and ri documentation while installing a gem by:

gem install rails --no-ri --no-rdoc

I am sure that you would not like to give –no-ri and –no-rdoc every time you install a gem. To avoid this situation, you can create/update $HOME/.gemrc file with following option:

gem: --no-ri --no-rdoc

Now every time you install a gem, it will skip installation of ri and RDoc for the gem.

My .gemrc file looks like:

---
:update_sources: true
:sources:
- http://gems.rubyforge.org/
- http://gems.github.com
:benchmark: false
:bulk_threshold: 1000
:backtrace: false
:verbose: true
gem: --no-ri --no-rdoc

Terminate called after throwing an instance of ‘int’

Ever faced “terminate called after throwing an instance of ‘int’ ” error in RubyOnRails?
or
Specially on linux machine only not on windows.

Error occurred specially when dealing with some image handling, or with attachment_fu.

The cause of this error is image_science 1.1.3 . Add :processor => “Rmagick” to has_attachment options and get rid of this problem.

Enjoy!!!

Leopard sucks while installing/updating gems

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 where on net. I don’t remember the link but it worked.

According to that, you just need to add:
require ‘resolv-replace’
as the first require in /usr/bin/gem file.

enjoy!!