Closed mareczek closed 8 years ago
The problem occurs when used with gem enumerize
@mareczek I have just gotten the same error. I have not yet investigated what I need to do to fix it though. Have you found a solution/cause?
I did not solve the problem. Both enumerize and globalize overwrite the same method, hence the problem.
My temp solution working until now was to not use both gems together in the same model.
Morgoth came to me in a vision and helped me produce this workaround:
def write_attribute(name, value, options = {})
return Globalize::ActiveRecord::InstanceMethods.instance_method(:write_attribute).bind(self).call(name, value, options) if translated?(name)
super(name, value)
end
You can put this in the class that has both enumerize and globalize.
Update:
Make sure that you extend Enumerize after the translates
though!
class MyModel < ActiveRecord::Base
translates :name
extend Enumerize
def write_attribute...
end
Hmm.. I don't seem to be able to reproduce this. I can update attributes fine with both globalize (latest on master
branch) and enumerize (2.0.0). Can either of you provide a concrete example?
This has been fixed in brainspec/enumerize#236, closing.
Whenever I send params, such as:
and in the controller:
i get:
ArgumentError (wrong number of arguments (3 for 2)):
globalize-accessors is at version 0.2.1