Using the OpenLink Rails ODBC Adapter with Microsoft SQL Server SQL Server 2000 / 2005
Type Mappings
ActiveRecord defines a number of abstract data types. These and the corresponding Ruby data types are listed in the table below. The native types to which the abstract types map to will depend to some extent on the underlying ODBC driver used by the OpenLink Rails ODBC Adapter. The native type mappings for the OpenLink SQL Server agents/Lite drivers are shown below.
| Active Record abstract type | Ruby type | SQL Server type |
|---|---|---|
| :primary_key | - | INT NOT NULL IDENTITY(1,1) PRIMARY KEY |
| :string | String | VARCHAR(2000) |
| :boolean | Object | BIT |
| :datetime | Time | DATETIME |
| :time | Time | DATETIME |
| :timestamp | Time | DATETIME |
| :date | Date | DATETIME |
| :text | String | TEXT |
| :integer | Fixnum | INT |
| :float | Float | REAL |
| :binary | String | IMAGE |
| :decimal | BigDecimal | NUMERIC |
It is suggested you use these native database types when creating tables to support your Rails models.