Tweaks to work with AuthLogic and namespaced classes

Authlogic uses regular expression validations containing \A and \z (e.g. for email and username validation) added replacement to ^ and $ so that it works on the client side. 

Using form_for with a class inside a module meant my input fields had names like module_class_name. The   logic to get the module name does not cope well with this, so I added an optional data attribute data-model-name to the input element. If this is present, it's used for uniqueness validations.