Skip to content


Subversion checkout URL

You can clone with
Download ZIP


Problems with multiple Devise Models (not all invitable) #203

jfeust opened this Issue · 0 comments

2 participants


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
def destroy_if_previously_invited
@scambra scambra closed this in f9255b7
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.