mardi 23 mai 2017

Rails Devise: two different after_update_path_for

I have two pages rendering the update user form of Devise. The classic one (users/edit) and a '/page' page with just a part of the full edit form. I would like to have two different after_update_path whether the form is submit to one or the other page. I tried several things but I none are working...

def after_update_path_for(resource)
    if current_page?('/page')
      :page
    else
      :root_path
    end
  end

Any idea if it's possible to do that?

Aucun commentaire:

Enregistrer un commentaire