I might be searching the wrong key words, but I can't find a way to only restrict users that are invited to be allowed to create an account on my rails site (or maybe I'm using devise-invitable wrong). I assume, there should be a method I call in the before filter or flip the switch on the initializer/devise.rb
I tried in my users_controller.rb and had no luck using Ruby Doc as reference
before_filter: invited?
I have read the initializers/devise.rb and the readme and didn't have any luck.
I figured out that I didnt think of the obvious. Restrict users via devise with the routes, not devise-invitable.
Used Solution #2 as a reference (see below)
Lets suppose that you don't want to allow to sign up but you want to allow to change password for registered users. Just paste this code in routes.rb:
And then you can make such link in your view:
Notice: you will need to update default devise views accordingly, i.e. in
app/views/devise/registrations/edit.html.erbchangeregistration_path(resource_name)touser_registration_path(resource)(If using shared views for multiple models, you can usesend("#{resource_name}_registration_path", resource))Notice: If you are using rails 4.0+ you should be using patch instead of put for updates. You should change the method in the form_tag residing in
app/views/devise/registrations/edit.html.erband theroutes.rbfile.