When i was switch over my ruby version from 1.8.6 to 1.8.7, i got this problem.Sinc i was using ubuntu 9.04, the default ruby version seems to be ruby 1.8.6.But for working with rails 2.3.5, ruby 1.8.7 is recommended.So from source i compiled the ruby 1.8.7 and the files installed in /usr/local/lib/ruby/.
Now i typed ruby script/server in the terminal, it asked for rails 2.3.5 gems.After installing i found this problem `require_frameworks': no such file to load -- openssl (RuntimeError).
If you encounter the above error, run the following to fix the error
$ sudo apt-get install openssl libssl-dev
$ sudo apt-get install ruby1.8-dev
$ cd /home/user/ruby-1.8.7/ext/openssl (source file of ruby-1.8.7)
$ sudo ruby extconf.rb
$ sudo make
$ sudo make install
Now the problem solved.