Giter Site home page Giter Site logo

globalize-versioning's People

Contributors

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

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

globalize-versioning's Issues

Rails 5.2 support

Are there any plans for update so newest rails versions are supported?

Value for translation field is the updated value instead of the previous value

Using Rails 4, Ruby 2.0.0p353, Globalize 4.0.0, paper_trail 3.0.0, master of globalize-versioning.

Product Model

class Product < ActiveRecord::Base
  has_paper_trail :ignore => [:updated_at]
  translates :title, :versioning => :paper_trail
end

Product Translation Model

class Product::Translation < ActiveRecord::Base
  #This issue is present regardless of whether 
  #this line is present but product.translation.versions
  # will be undefined if its not defined here
  has_paper_trail 
end
p = Product.create! title: "A"

p.translation.title
=> "A"

p.title
=> "A"

p.versions.count
 => 2 #This should be 1 right?

p.translation.versions.count
 => 1

#####Update a translation field
p.update!(title: "B")

p.title
=> "B"

p.previous_version.title
 => "B" #This should be 'A' right?

p.translation.previous_version.title
 => "A"

To summarize for translation fields, the updated value 'B' is being saved to the version table instead of the previous version. All non-translation fields are following this behavior correctly.

I saw your post that said "The syntax has changed somewhat: you have to call post.translation.versions now instead of just post.versions", but the issue is that

p.previous_version != p.translation.previous_version
=> true

because the model is partially translated. There are other fields in the product table that are not part of the product_translations table because they do not require translation...

Undefined method 'locale=' issue

I am having the exact same issue as mentioned here:

globalize/globalize#101

I managed to fix the problem by following the advice, and creating a migration to add 'locale' to the versions table.

Perhaps there is a proper fix, or perhaps I have done something wrong?

Release globalize versioning support as separate gem

To anyone who's coming here from Globalize: we're extracting versioning functionality into this new gem. We had considered creating two gems, one for paper_trail and one for vestal_versions, but in the end it seems easier to start with one gem, and just get the stuff out of core asap.

I've incorporated @robotvert's fix (#1) and added models and data to get the versioning tests from Globalize to work. I've also created branches for AR3 and AR4 with versioning support removed, and started writing up a basic roadmap in the Wiki.

The basic idea is: test against the "gutted" versions of AR3/AR4, and once we have something that looks workable, we can release this gem and new gutted versions of Globalize 3.0.x and 4.0.x, with a post install message warning users to add the globalize-versioning gem if they want to continue using versioning.

But we still need to decide what interface we want to use (i.e. what option should be passed in to translates to select the versioning gem, do has_paper_trail and translates have to be called in the correct order, etc.). @etagwerker has proposed some changes to get versioning working in 3.0.x in globalize/globalize#298, which we could incorporate here.

I don't use paper_trail or vestal_versions myself so I feel a bit out my comfort zone with this stuff (and I think @parndt is the same) which is part of the reason we have not moved very quickly on this issue. But obviously a lot of people want to use these gems together, so I'd like to focus discussion in this issue and other issues on this gem rather than in Globalize.

Shout out to: globalize/globalize#272, globalize/globalize#221, globalize/globalize#206 and globalize/globalize#117.

Reify doesn't seem to work

because of this, in paper_trail

 # Set all the attributes in this version on the model
    attrs.each do |k, v|
      if model.has_attribute?(k)
        model[k.to_sym] = v
      else
        logger.warn "Attribute #{k} does not exist on #{item_type} (Version id: #{id})."
      end
    end

I had to patch my translated model to do this

def has_attribute?(att)
  super(att) || translated?(att)
end

Not sure if it's the best solution, though..

Add support for globalize 5+

This is a request to add support for globalize v5+.

It looks like the globalize gem is now at v5+, but there is a restriction in the gemspec in globalize-versioning that limits it to globalize < v5. The following fork has made changes that allow globalize v5+ to be used with globalize-versioning:

master...panyamin:master

Changes both in translation and original model versions

When I change a translated column of my model, 2 versions are created, one for the base model and one for the translation model. That seems right. But then both of these versions have the change in the change column. Why is that? That would mean we wouldn't actually need to create a version for the changed translation model, right. The version of the base model with the correct locale would be sufficient.

Compatible with paper_trail (4.0.0.beta1)?

Hi there,

May I know if the gem is compatible with paper_trail (4.0.0.beta1)? I wanted to update the paper_trail gem to get rid of deprecation warning in Rails 4.2 but encountered the following error. Thanks very much for your attention.

Bundler could not find compatible versions for gem "paper_trail":
In Gemfile:
globalize-versioning (> 0.1.0) ruby depends on
paper_trail (
> 3.0.0) ruby

paper_trail (4.0.0.beta1)

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.