Coder Social home page Coder Social logo

globalize-versioning's Introduction

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.

globalize-versioning's People

Contributors

arich avatar neolyte avatar oz avatar parndt avatar sedubois avatar shioyama avatar simi avatar vrodokanakis avatar

Watchers

 avatar

Forkers

s-vm

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.