Allowing attribute names with spaces and other characters (in AttributeMethods)


I opened a ticket with a patch that allows the use of spaces and other unconventional characters in attribute names in the AttributesMethod plugin in ActiveModel.

This is a simple patch that changes dynamically generated methods from being defined with ‘def’ to ‘define_method’ and adds some quoting.

The idea behind it is that it would allow those of use who use databases like couch (or mongo?) to utilize ActiveModel’s features without translating the attribute names to be ‘def’ friendly.

The other features like validations already work with fields with spaces, and the Dirty plugin works with this as well. I can’t think of any potential downsides to this patch, since it doesn’t change anything semantically.

The ticket is here:

What do you think of this idea?