This is a big jump step for Netbean 6 preview (M9) which is including Ruby and Ruby on Rails plugin in it. I use Netbean since 3.2 version to develop any desktop java application. Now with Netbean 6, I also can develop Ruby on Rails application easily. Here are some Ruby/RoR features that you can use with Netbean 6 :
* Tools > Ruby Gems
this tool will provide you gems package management easily. Netbean 6 will include automatically ActiveRecord-JDBC gems module.
* There are two sample interesting Ruby on Rails applications, i.e. Flickr on Rails Sample App and Ruby Weblog Sample App. With this sample, we can learn many things about Ruby on Rails tips and trick.
* You can create Ruby / Ruby on Rails projects easily
* JRuby is a default ruby intepreter in Netbean 6.
I will continue this conversation with how to develop a simple RoR application with Netbean 6.
If you want to build Ruby on Rails application to connect to Oracle10g database, you have to install Ruby/OCI8 from Rubyforge. After downloading and extracting the file, please read README file. Before compiling, I have to check the Oracle connection and prepare some environment variables :
ORACLE_BASE=/u01/app/oracle; export ORACLE_BASE
ORACLE_HOME=$ORACLE_BASE/product/10.2.0/db_1; export ORACLE_HOME
ORACLE_SID=budsus; export ORACLE_SID
ORACLE_TERM=xterm; export ORACLE_TERM
PATH=$ORACLE_HOME/bin:$PATH; export PATH
export LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib:${LD_LIBRARY_PATH}
Here is the sqlplus command to check the Oracle database connection from my session :
sqlplus hr/hr@localhost:1521/budsus
If you get the SQL> prompt from SQL*Plus environment, you have successfull to connect to Oracle database.
Here are some steps to create a simple RoR application to access HR.EMPLOYEES table :
1. rails hr
2. I read a helpful documentation from http://wiki.rubyonrails.org/rails/pages/Oracle to help me to understand about the database configuration. Here is my database.yml configuration :
development:
adapter: oci
host: (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(Host=localhost)(Port=1521))(CONNECT_DATA=(SID=budsus)))
username: hr
password: hr
(note: if you are using OracleXE, you must use XE as SID)
3. ruby script/generate model Employee
4. ruby script/generate scaffold Employee
5. ruby script/server
From my browser, I can access http://localhost:3000/employees/list. I hope this article can help you. Thanks
Hi all!!
Ok getting start the tutorial with wonderful plugin which is called Ajax Scaffold Generator.
Basically, Rails Scaffolding never generates the Ajax based interface. However, this plugin gives you the comfortable user interface. This time, try to create the very very simple user management system. Please, follow the simple instruction below to create the application!!
CREATE DATABASE AND TABLES
DATABASE: rails_demo1
TABLE : users*
*"users" table should contain the username and password field and put more features if you want!!
5 Steps to be happy!!
#Creating project skelton $ rails devils_demo1 #Creating Model $ ruby script/generate model User #Installing Ajax Scaffold Generator $ gem install ajax_scaffold_generator #Creating Ajax Scaffolding $ ruby script/generate ajax_scaffold admin User #launch Web server and Confirm!! $ ruby script/server
check and play with your application with following URL
http://localhost:3000/admin/
Oh... this time there is no Ruby code(T3T)!! However fair enough!!
Ok, next time we can start the real Ajax tutorial with Rails!!
See you next week!! Bye-bye!!

