I'm sure you've found a solution or workaround to your problem by now, but for any future group members who encounter the same problem I found a pretty simple fix.
Devise Invitable's model configuration docs<https://github.com/scambra/devise_invitable#model-configuration>don't fully explain how to implement ':validate_on_invite', but you have to set the configuration option to 'true' - :validate_on_invite => true. Here's what my devise method looks like in my User model for this to work correctly. # Include default devise modules. Others available are: # :confirmable, :lockable, :timeoutable and :omniauthable devise :invitable, :database_authenticatable, :registerable, :recoverable, :rememberable, :trackable, :validatable, :validate_on_invite => true Now when I attempt to submit an invitation it is fully validating the User model before allowing the invitation to be sent and user record to be created. Looking at the docs, I'm guessing you can also enable this setting in the devise initializer with - config.validate_on_invite = true - but I haven't tried going that route. On Thursday, September 26, 2013 1:49:57 PM UTC-4, Walter Lee Davis wrote: > > 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+unsubscr...@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/2e9900e6-62b7-42e3-b163-88f8779f1a54%40googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.