Rails SQL Procs
Library which adds SQL Stored Procedures to Rails. Adds create_proc and drop_proc to the ActiveRecord::ConnectionAdapters::AbstractAdapter (which makes them available to migrations) and adds support for dumping procs in the ActiveRecord::SchemaDumper.
Installation
To install:
gem install procbuddy
Then add the following to your Rails config/environment.rb:
require_gem 'procbuddy'
require 'procbuddy'
Usage
You can then use create_proc and drop_proc in your migrations. For example:
class CreateLameProc < ActiveRecord::Migration
def self.up
create_proc :lameness, <<EOSQL
SELECT 1 + 1 as lame EOSQL
end
def self.down
drop_proc :lameness
end
end
This extension also adds support for procs in the ActiveRecord::SchemaDumper class.
The following drivers are supported:
SQL Server
Known Issues
-
Drivers not mentioned above are not supported.
If you find any issues please send an email to [email protected] .
Contributing
If you would like to implement stored procedure support for other adapters then please drop me an email. Better yet, write up the adapter modifications and send them to me. :-)