How I find it (on example with globalize and better_nested_set
plugins):
On using these 2 plugins, update on translation is wrong (it
updates "base language" with wrong value), and be sure, this bug
not only globalize relative :)
Both of these plugins handle update actions, and some stuff for
it, like "attributes_with_quotes", and both of them not want to
write some fields with some conditions. What I have now - globalize
override the attributes_with_quotes to remove "translatable"
fields, if language not "base", and store there fields on own
table. In the same time better_nested_set want to remove own fields
(left and right borders), to check them and update later if
necessary. Both plugins have a copy of base attributes_with_quotes,
with own conditions, and I lose some changes on attributes, will
get only last changes with attributes, like - only nested_set
attributes will be deleted, so globalize attributes will be
wrong.
I fixed this with changes in plugins, but think that this is
little wrong, because any other plugins will have same story if
they use attributes_with_quotes method to make changes in
attributes (maybe exists some pretty way to do this, but like we
see - 2 popolar plugins use "bad" way to make theirs things).
I suggest small changes in ActiveRecord::base.update (2489 line
here) -
def update(attribute_names = @attributes.keys) quoted_attributes
= attributes_with_quotes(false, false, attribute_names) ....
to make something like here (just a quickly idea) -
def update(attribute_names = @attributes.keys) attribs =
attributes_to_update quoted_attributes = quote_hash_values(attribs)
....
this will allow to other plugins handle attributes_to_update
action, and make its own things with copy of attributes.
We should get attributes that was changed with all plugins that
want some changes, not only last plugin's, like we see now.