Skip to content
Rails SQL Views project extracted from ActiveWarehouse
Find file
Latest commit bb531df Feb 11, 2014 @aeden aeden Merge pull request #15 from pisaruk/master
Deal with create view sql where tabs, newlines or space are used and retrieve view_definition from sys.objects
Failed to load latest commit information.
lib Avoid problem with column truncation by selection directly from sys.o… Feb 10, 2014
test optionally specify the order in which views are created Aug 25, 2010
.gitignore Moving configuration of drivers into a YAML file. Aug 25, 2010
CHANGELOG added nonview_tables where missing. need to get tests running again Nov 4, 2008
CONTRIB initial checkin to git May 16, 2008
LICENSE added license Aug 19, 2008
README initial checkin to git May 16, 2008
Rakefile Gemified with jeweler Aug 25, 2010
TODO Renamed Adapter#nonview_tables to #base_tables with an alias to the o… Apr 7, 2009
VERSION Version bump to 0.8.0 Aug 25, 2010
init.rb Adding init.rb. Jun 24, 2009
rails_sql_views.gemspec Gemified with jeweler Aug 25, 2010


== Rails SQL Views

Library which adds SQL Views to Rails. Adds create_view and drop_view to the ActiveRecord::ConnectionAdapters::AbstractAdapter (which makes them available to migrations) and adds support for dumping views in the ActiveRecord::SchemaDumper.

== Installation

To install:

  gem install rails_sql_views
Then add the following to your Rails config/environment.rb:

  require_gem 'rails_sql_views'
  require 'rails_sql_views'

== Usage

You can then use create_view and drop_view in your migrations. For example:

  class CreatePersonView < ActiveRecord::Migration
    def self.up
      create_view :v_people, "select * from people" do |t|
        t.column :id
        t.column :name
        t.column :social_security

    def self.down
      drop_view :v_people
This extension also adds support for views in the ActiveRecord::SchemaDumper class.

The following drivers are supported:

 PostgreSQL (Native and Pure Ruby)
 SQL Server

== Known Issues

* Drivers not mentioned above are not supported.

If you find any issues please send an email to .

== Contributing

If you would like to implement view support for other adapters then please drop me an email. Better yet, write up the adapter modifications and send them to me. :-)
Something went wrong with that request. Please try again.