What are the Database Object Conventions required by Rails when using Oracle?
Rails is designed to use a number of conventions related to database objects. You can work around them (and you’ll need to when working with legacy databases), but adhering to them greatly speeds application development and results in code that’s easier to maintain. Two conventions are fundamental to Rails development: • Table names should be plural. The table will map to a Model object that has the same name but in the singular form. • A primary key of type NUMBER named id should be created for each table. This column will serve as the unique identifier used by Rails to retrieve records by default. When using Oracle applications, create a sequence that uses the table name followed by “_seq”. A number of column names have special significance within a Rails application. The id column serves as the primary key, as mentioned above. Columns that contain ids for related tables are named in the format
Related Questions
- Connect to the database you intend to use for the application through SQL*Plus and create your database objects. See What are the Database Object Conventions required by Rails when using Oracle?
- What are the Database Object Conventions required by Rails when using Oracle?
- Why work with Oracle and not an Object Oriented Database Management System?