Situation:
I have an Account
model which is a devise model and I'm looking to disable users from being able to register themselves. There is a similar question on SO already but the proposed answer is just not working for me and it also does not have any templates in the answer.
Here's my setup:
registrations/edit.html.erb
<%= form_for resource, as: resource_name, url: account_registration_path(resource_name), html: { method: :patch } do |f| %>
...
<% end %>
I had to change the url:
from registration_path
to account_registration_path
for the form to even render.
The problem is I cannot submit the form without it throwing an error. It errors out with:
ActionController::UnknownFormat in Devise::RegistrationsController#update
routes.rb
devise_for :accounts, skip: [:registrations]
as :account do
get "accounts/edit" => 'devise/registrations#edit', as: 'edit_account_registration'
patch "accounts" => 'devise/registrations#update', as: 'account_registration'
#delete "account" => 'devise/registrations#destroy', as: 'destroy_account_registration'
end
Is it possible to somehow set this up in such a way that the url paths for editing the profile are identical to the ones devise supplies when registrations is not disabled?
I still want users to be able to edit/cancel their account, just not register.