Rails 3.2.14, Ruby 1.9.3, devise_invitable 1.1.8
I am trying to get invitations containing custom fields to validate
their contents properly. I have tried the invite_keys hash route, as
documented here:
GitHub - scambra/devise_invitable: An invitation strategy for devise and
unless I am doing something wrong with my Regexps, what happens is the
fields are validated, but the error messages are incorrect[1].
I also tried adding regular validations on the model, but they aren’t
being called at all (only the built-in e-mail error is handled). When I
tried adding validate_on_invite to my model, I got an error:
uninitialized constant Devise::Models::ValidateOnInvite when I started
the application.
Is there an example somewhere showing how to configure the model to
validate custom fields on invitations?
Thanks!
Walter
- Just to clarify what I mean by error messages are incorrect: If all
the fields are left blank, there is an error on each field saying
“[field name] cannot be blank”. That’s as expected. If any of the fields
are properly filled in, then that field is listed in the errors as
“[field name] is invalid”, while the missing fields still say “[field
name] cannot be blank”. Only if all fields are properly filled in does
the form submit, naturally. I would expect the fields that match their
regexp to not have errors attached at all.