Wednesday, October 3, 2007

Using Interbase 2007 in Ruby on Rails Project

Joe McGlyn, Director of Product Management at CodeGear has shown the way to use Interbase 2007 in Ruby on Rails as follows :-

Assuming you already have a project, here are the basic steps to modifying a project to work with InterBase as the database...

1. Get the InterBase gem
gem install ibruby

Comments by CCH :
There are a few ways to do this
a) c:\instantrails\ruby\bin >gem install ibruby

b) In Aptana RadRails,
i) call up the Gems Manager from
Windows\show view\Ruby Gems
ii) Within the Gems Manager
- Click Install
- select ibruby Gem

You can then see the progress within the Console Tab

c) In 3rdRail, you can use the Project Commander


2. Get the Rails adapter (from the root dir of your rails app or from the project commander) script/plugin source http://ibruby.rubyforge.org/svn/rails_plugins/trunk/
script/plugin install ibrails_plugin

Comments by CCH
a) Shell to Command prompt and cd to root of your project folder

c:\project_name>ruby script/plugin source
http://ibruby.rubyforge.org/svn/rails_plugins/trunk/
c:\project_name>ruby script/plugin install ibrails_plugin

b) Using Aptana Radrals,
i) select the Rails Plugins Tab
ii) select ibruby and click Go

Nb. If ibruby does not show in the list, revert to method (a) :-)

c) In 3rdRail, you can use the Project Commander

NOTE :
You will also need to add these two lines into your Rails
environment.rb file:
# ------ force InterBase support to be added to Rails
# ------ as Rails currently has no way of extending its db
# ------ support apart from a new Rails release!
require 'active_record'
require 'vendor/plugins/ibrails_plugin/lib/ibrails_plugin'
# ------
Ideally these two lines should appear after the line loading
boot.rb which typically looks like this:
require File.join(File.dirname(__FILE__), 'boot')
and before anything else gets done (particularly any
initialization)

3. Assuming you have IB installed, and have the default IB user/pwd enabled you're good to go.
It will even create the database file (within your project directory by default)
Known limitation:Indicies are limited to ~200 characters, depending on how they are composed. This is InterBase, not the integration.

Comments by CCH

Despite religously following the instructions from Joe McGlyn of CodeGear, I have not been able to overcome the barrier and error message
ie "database configuration specifies nonexistent interbase adapter"
You may want to read the thread "Using Interbase with RoR" started by Joe here borland.public.3rdrail.ide

No comments:

Welcome to Rails.. Rails... Rails !

In 1995, I started the popular Clipper...Clipper... Clipper website (no blogs then) which was very popular and linked by virtually every Clipper-related site. When I switched to Windows via Delphi in 1997, I started the Delphi... Delphi... Delphi site. In June 2007, I discovered Ruby on Rails and no prize for guessing what I am gonna name this blog. which I started on 2nd October 2007.

As at 10th June 2010, we have 13,364 unique visitors from more than 84 countries such as Angola, Andorra, Argentina, Australia, Austria, Algeria,Barbados, Bosnia and Herzogovina, Belgium, Brazil, Bulgaria, Bangladesh, Belarus, Bolivia, Chile, Cambodia, Cape Vede, Canada, China, Colombia, Costa Rica, Croatia, Cyprus, Czech Republic, Denmark, Egypt, Estonia, Finland, France, Guadeloupe, Guatemala, Germany, Greece, Hong Kong, Hungary, India, Indonesia, Ireland, Israel, Italy, Japan, Kenya, Korea, Lithuania, Latvia, Malaysia, Mexico, Macao, Netherlands, Nepal, Norway, New Zealand, Oman, Panama, Peru, Poland, Portugal,Paraguay , Philippines, Romania, Russian Federation, Saudi Arabia, Singapore, Spain, Slovakia, Slovenia, Serbia, South Korea, Slovenia, South Africa, Spain, Switzerland, Sri Lanka, Sweden, Taiwan, Thailand, Turkey, United Arab Emirates, Ukraine, USA, UK, Venezuela, Vietnam

CCH
10th June 2010, 19:42