Skip to content

mtodd/activerecord-table_version

Repository files navigation

ActiveRecord::TableVersion

Makes setting table name versions simple.

Example


class Model < ActiveRecord::Base
  set_table_name    "foos"
  set_table_version "2011_01_25"
end

Model.table_name #=> "foos_2011_01_25"

Installation

Depends on ActiveRecord. Works with both versions 2.3.10 and 3.0.3.

Install the gem with:
gem install activerecord-table_version

Or, in your Gemfile:
gem "activerecord-table_version", "~> 0.0.1"

If you’re on an older version of Rails:
config.gem "activerecord-table_version", :version => "~> 0.0.1"

Migrations and Warning

In order to apply migrations, you will need to refer to the table_name of the model directly.

NOTE: This has not seen extensive production use and this may result in problems in practice. You’ve been warned.

License and Copyright

The MIT License

Copyright © 2011 Matt Todd.

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the “Software”), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.

About

Set table version for ActiveRecord models

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages