Connecting ActiveRecord to SQL Server

What is ActiveRecord?

  • ActiveRecord is a Ruby library that was written by the creators of Ruby on Rails to do database integration. It connects classes to relational database tables to establish an almost zero-configuration persistence layer for applications.

That’s great, but we’re not using Ruby on Rails and our web app has SQL Server on the back end. How can we leverage ActiveRecord in our environment?

  • Good news! You can use ActiveRecord without Rails! If you are a Ruby programmer, you can can connect very easily to SQL Server to create models! You get a great deal of functionality such as basic CRUD operations, data validations, search support and many others!
  • All of this can be accomplished with the activerecord-sqlserver-adapter gem.

How do I connect ActiveRecord to SQL Server?

For more information, check out my example:

Tagged

One thought on “Connecting ActiveRecord to SQL Server

  1. charleybaker says:

    Cool post, nice to see some example code too. You might check out the tinyTDS project which eliminates the need for ODBC. I haven’t given it a run yet, since I have no SQL Server currently, but would love to see your take:

    https://github.com/rails-sqlserver/activerecord-sqlserver-adapter/wiki/Platform-Installation—Windows

    and

    https://github.com/rails-sqlserver/activerecord-sqlserver-adapter/wiki/Using-TinyTds

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: