A Rails adapter enabling ActiveRecord to connect to and interact with Microsoft SQL Server databases.
ActiveRecord SQL Server Adapter is a Ruby gem that enables Ruby on Rails applications to use Microsoft SQL Server as their database backend. It provides a seamless interface between ActiveRecord, Rails' object-relational mapper, and SQL Server, handling connections, queries, migrations, and data type mappings. It solves the problem of integrating enterprise SQL Server databases into Rails projects without sacrificing ActiveRecord's productivity features.
Ruby on Rails developers and teams whose applications need to connect to and operate on Microsoft SQL Server databases, particularly in environments where SQL Server is the mandated or existing data store.
Developers choose this adapter because it is the official, actively maintained solution for SQL Server integration with Rails, offering full ActiveRecord compatibility, support for modern SQL Server data types, and a versioning policy that tracks Rails releases for stability.
SQL Server Adapter For Rails
Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.
Tracks Rails versioning policy closely, with adapter versions tied to specific Rails releases for stability, as shown in the detailed support table in the README.
Supports SQL Server-specific features like stored procedures via execute_procedure, computed columns in migrations, and schemas, enabling enterprise database workflows within Rails.
Maps Rails types to SQL Server's national data types such as datetime2 and datetimeoffset, with precision settings, ensuring accurate data handling as detailed in the Native Data Type Support section.
Integrates with ActiveRecord's explain to output SQL Server SHOWPLAN in table or XML format, aiding performance tuning, though it has limitations.
The explain implementation is admitted to be fragile for complex SQL and can break applications, requiring disabling if issues arise, as noted in the README with a warning about no fixes without patches.
Identity inserts with triggers necessitate manual configuration via exclude_output_inserted_table_names, adding overhead and potential for errors in trigger-heavy databases.
Requires non-trivial setup like TinyTDS dependencies, schema prefixes (e.g., 'dbo.'), and lowercase schema reflection for mixed-case databases, increasing initial complexity.