0.0
Repository is archived
No commit activity in last 3 years
No release in over 3 years
Rails extension
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

Runtime

> 3.0
 Project Readme

IrxrbRails

This gem provide some rails feature

  • Database View

Database View

Install

If you use (Rails.version < 4.1.0), nothing to do.

If you use (Rails.version >= 4.1.0) and test, you must rewrite rails_helper following way.

from:

ActiveRecord::Migration.maintain_test_schema!

after:

Irxrb::Rails::DBViewMigrator.migrate do
  ActiveRecord::Migration.maintain_test_schema!
end

How this work.

RakeTask db:migrate:drop is invoked before db:migrate and db:views:migrate is invoked after db:migrate

db:views:drop task drop all DB views. db:views:migrate task create DB views from db/migrate/views directories.

Sample

Following script in db/migrate/views/concat_user.rb create concat_user view.

Irxrb::Rails::DBViewMigrator.define do
  create_view :concat_user do
    "SELECT id, (first_name || ' ' || last_name) concat_name FROM users"
  end
end

Learn more