No release in over 3 years
Low commit activity in last 3 years
Provides support for using versioning gems such as PaperTrail with Globalize.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

Runtime

>= 4.2.0, < 6.1
>= 4.2.0, < 6.1
>= 5.1.0, < 6
>= 8, < 12
 Project Readme

Globalize Versioning Build Status

Introduction

globalize-versioning provides an interface between globalize and versioning gems such as PaperTrail.

At the moment, only paper_trail is supported, but support for other versioning gems is planned for the future. Pull requests are always welcome.

Installation

gem install globalize-versioning

When using bundler, add this line to your Gemfile:

gem 'globalize-versioning'

Usage

To add versioning support to your model, just add the :versioning option to your call to translates with the name of the versioning gem as its value. For example:

translates :title, :content, :published, :published_at, :versioning => :paper_trail

You will also need to have already generated the versions table that paper_trail expects. See the paper_trail README for more details.

To pass options to the versioning gem, replace the gem name with a hash, and include the options as the value of the :options key:

translates :title, :content, :published, :published_at, :versioning => { :gem => :paper_trail, :options => { :on => [ :update ] } }

To access versions of a translated model, use the format: post.translation.versions. Earlier versions of the globalize versioning support delegated version and versions to the model translation (so you could access them with just post.versions), but this causes problems if versioning is used on non-translated attributes, and has thus been removed.

Adding globalize versioning to previously versioned models

If you are adding globalize to any previously versioned models, please note that you will need to add a new locale column to your versioning table.

Other gotchas

Please see the tests in test/globalize-versioning/ for more details.

License

See LICENSE for details.