Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

serialize problems #4

Closed
slbug opened this issue Nov 26, 2010 · 4 comments
Closed

serialize problems #4

slbug opened this issue Nov 26, 2010 · 4 comments

Comments

@slbug
Copy link
Contributor

slbug commented Nov 26, 2010

i'm using i18n-active_record backend with rails master. in i18n initializer i have following code:

I18n::Backend::ActiveRecord.send(:include, I18n::Backend::Flatten)
I18n::Backend::ActiveRecord.send(:include, I18n::Backend::Memoize)
I18n::Backend::Simple.send(:include, I18n::Backend::Memoize)
I18n::Backend::Simple.send(:include, I18n::Backend::Pluralization)
I18n::Backend::Chain.send(:include, I18n::Backend::ActiveRecord::Missing)

I18n.backend = I18n::Backend::Chain.new(I18n::Backend::Simple.new, I18n::Backend::ActiveRecord.new)

And because of 'serialize :value' in lib/i18n/backend/active_record/translation.rb AR serializes every field named value in any model, but everything ok using rails 3.0.3.
Seems like they changed something in include proccess and it includes 'serialize :value' and 'serialize :interpolations' to every model.
Can you please check it?

@slbug
Copy link
Contributor Author

slbug commented Nov 26, 2010

>> Mymodel.serialized_attributes
=> {"value"=>Object, "interpolations"=>Array}

temporary solution

Mymodel.serialized_attributes = {}

@slbug
Copy link
Contributor Author

slbug commented Dec 7, 2010

any chance to get fix for it? thanks.

@wdiechmann
Copy link

I'm on ruby 1.9.2p290 and rails 3.2.8 and my translations do not exhibit this kind of problem - but then again - my initializers/locale.rb does look like this:

require 'i18n/backend/active_record'
require 'i18n_cache_backend'
I18n.backend.class.send(:include, I18n::Backend::Fallbacks)
active_record_backend = I18n::Backend::ActiveRecord.new
active_record_backend.class.send(:include, I18n::Backend::Fallbacks)
I18n::Backend::ActiveRecord.send :include, I18n::Backend::Cache
# I18n.cache_store = Rails.application.config.i18n_cache_store
# .cache_store = ActiveSupport::Cache.lookup_store(:memory_store)
I18n.backend = I18n::Backend::Chain.new(active_record_backend, I18n.backend)
  • but by default I had

    = f.input :interpolations

in my administrative translations management form, and that 'saved' me from persisting my translations with a message resembling this issue - and debugging on the create action further showed me that the error hinted at interpolations being serialized as string when expected to be an array.

Once I lost the interpolations field in my form, everything was perfect :)

@timfjord
Copy link
Collaborator

timfjord commented Mar 1, 2016

Issue is quite old, so i am not sure if it is still relevant. So closing this for now.

@timfjord timfjord closed this as completed Mar 1, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants