Sonny Black
Sonny Black

Reputation: 1617

secondary edit pages for user profile

I have a settings tab which links to the user to edit_user_registrations_path corresponding to the devise/registrations/edit.html.erb page.

I've created another page under devise/registrations called edit_account.html.erb and I'd like this to allow the user to edit additional settings like Twitter and any other social networks that allow it.

My route:

devise_scope :user do
  get "edit/edit_account", :to => "devise/registrations#edit_account"
end

error:

undefined method model_name error:: <%= simple_form_for(resource, :as => resource_name, :url => registration_path(resource_name), :html => { :method => :put }) do |f| %>

Basically, the form_for resource in the secondary edit page is causing an error. What should I change that too to work with the new route?

Upvotes: 0

Views: 136

Answers (1)

Rajdeep Singh
Rajdeep Singh

Reputation: 17834

you can try this one instead to add a new action to registrations controller

devise_for :users do
  get "edit/edit_account", :to => "devise/registrations#edit_account", :as => "account_registration"
end

But it would be better if you create a new controller named users_controller.rb and add the required action in it

Upvotes: 1

Related Questions