Closed caironoleto closed 12 years ago
I think it's not due the merge, but because class_attribute
is shared among the subclasses of the one that includes I18n::Alchemy
. I might work on something to handle that later.
I don't think so, with the 2d478150d258750269bf1b14af7ccb45268548a3 version:
1.9.3p194 :001 > ActiveRecord::Base.customized_parsers
=> {}
1.9.3p194 :002 > MonthlyStatement.customized_parsers
=> {:initial_competence_date=>CompetenceParser, :end_competence_date=>CompetenceParser}
1.9.3p194 :003 > ActiveRecord::Base.customized_parsers
=> {}
I think the problem is in the piece of code in lib/i18n_alchemy.rb
:
def localize(*methods, options)
parser = options[:using]
methods = methods.each_with_object(localized_methods) do |method_name, hash|
hash[method_name] = parser
end
self.localized_methods = methods
end
Oh, the each_with_object(localized_methods)
call is mutating the parent Hash, need to fix that :)
Exactly, right on the spot, thanks guys.
Hi mate!
In our application, we have an i18n_alchemy initializer and we do this:
And all active record classes has i18n alchemy loaded.
But, with the merge of localize methods and custom parsers we get the following bug:
Before the merge, we had two different methods,
localized_methods
andcustomized_parsers
.We don't use localize methods, only in attributes and now we using custom parsers.
I'm thinking this problem can occur with only localize methods too.
So, you have any solution for us?!