0

After entering and sending password instruction email via Devise, I want to redirect to home (root) page, not the default log in page. Per instructions on SO, I've edited passwords_controller.rb as follows:

class Users::PasswordsController < Devise::PasswordsController
  protected
  def after_sending_reset_password_instructions_path_for(resource_name)
    # super(resource_name)
    root_path
  end
end

My routes.rb:

  devise_for :users

  devise_scope :user do
    authenticated :user do
      root 'places#route', as: :authenticated_root
 
    unauthenticated do
      root 'places#index', as: :unauthenticated_root
    end
  end

The places controller with "route" from above:

    def route
        path = case current_user.memberships.exists?
            when false
                pages_path
            else
                page_path(current_user.memberships.where(page_id: @page))
            end
        redirect_to path     
    end

What could I be doing wrong? I'd really appreciate it.

superbot
  • 401
  • 3
  • 19

0 Answers0