Error editing user registry with nested_form

1

I have a problem with an application I made here on the service. I use nested_form together with Devise for a student registration, that is, when registering a student, I already add a user to it in the system, which can have access to notes among other things. However, when I edit the registry, it asks me to add the password again. I tried to create the customized controller, but I did not succeed. So I send the links to some files so that a charitable soul can help me.

User Model
link

Student model
link

Student Controller
link

    
asked by anonymous 01.12.2014 / 12:46

1 answer

0

As I recall, Devise asks to confirm the password whenever the user changes.

The devise wiki has a section talking about it. ( link )

But as you are dealing with a nested resource, my suggestion would be a hack within the user model, in which you would override the User update to call the update_without_password method. In that case it would look like this:

class User < ActiveRecord::Base
  def update(params, *options)
    update_without_password(params, *options)
  end
end

But remember that I'm not sure it works, and remember that this will override the update method in all cases (though I believe you could do this only by saving for Student with a little metaprogramming)

    
18.03.2015 / 00:12