Today I learned about the latest popular Ruby on Rails. I feel that it is a code generator linked to Oracle.DatabaseI checked the data for half a day. Finally, I found a solution. ^ ______ ^
1. Install the driver
Http://rubyforge.org/projects/ruby-oci8/
Download and run (double-click) *. rb in the ruby-oci8-mswin
2. Change database. yml
Development:
Adapter: oci
Host: examplesid
Username: exampleuser
Password: examplepass
Or
Development:
Adapter: oci
Host: 192.168.0.50/examplesid
Username: exampleuser
Password: examplepass
The database field is not used; exampleuser can be replaced by tns;
My oracle is installed on another machine, so the configuration is as follows:
Development:
Adapter: oci
Host: MyTnsName
Username: system
Password: manager
3. Table creation considerations
In ruby on rails, the default data table names are all plural nouns, that is, if you want to use the following command:
Ruby script/generate scaffold Item Manage
The name of your data table is Items (Note S), and the location is the default space of username in the database. yml just created.
I am using ruby 1.8.4.
Rails 1.0.0
When creating a table, you must have a field named ID and create a {table_name} _ seq sequence for the table. The method is as follows:
For example, in my Items data table, the fields include ID, Title, and Createdat, and an Items_seq sequence (SQL: create sequence Items_seq increment by 1) is created)
4. Use ruby script/server to check the results. ^____ ^