Basically I have two completely separate devise models in my app. Users are :invitable. Reps are not :invitable. Both have their own Registation controller: Users::RegistrationsController and Reps::RegistrationsController.
The problem I'm encountering is that lib/devise_invitable/controllers/registrations.rb is injecting the destroy_if_previously_invited method into my non invitable Reps::RegistrationsController. Thus line 28 is being called:
resource = resource_class.where(:email => hash[:email], :invited_by_id => nil).first
But Reps does not have an "invited_by_id" field so I get the following error
ActiveRecord::StatementInvalid: PG::Error: ERROR: column reps.invited_by_id does not exist
I'm not sure what determines if the "destroy_if_previously_invited" method gets injected into the Devise Registration controller, but there should be a way to say "this devise model (and controllers) are not invitable, so don't inject these additional methods".
My current hacky fix is to overwrite the "destroy_if_previously_invited" method in Reps::RegistrationsController
# overwrite to fix devise invitable issue
Fix #203, keep invitation info on registering only for invitable reso…