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: https://github.com/scambra/devise_invitable#model-configuration 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
1. 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.
--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/E8420AD6-ECDE-4C10-9678-8F796EFB8218%40wdstudio.com.
For more options, visit https://groups.google.com/groups/opt_out.
No comments:
Post a Comment