-
Type: Bug
-
Resolution: Fixed
-
Priority: Minor - P4
-
Affects Version/s: 5.2.0
-
Component/s: Attributes
I create dynamic attributes and some of them have spaces or other unicode characters not compatible with ruby identifier syntax for naming methods. For example, i have a dynamic attribute named 'phone number 2'. Using define_method, there is no problem defining any type of method which uses this name. However, in Mongoid, it uses class_eval which causes my application to crash:
def define_dynamic_before_type_cast_reader(name)
class_eval <<-READER
def #{name}_before_type_cast
attribute_will_change!(#{name.inspect})
read_attribute_before_type_cast(#{name.inspect})
end
READER
end
Now I cannot use form builder elements like f.text_field
Is there any temporary solution around this bug?