Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Added ability to override redirect_to path after sending reset password ... #1750

Merged
merged 2 commits into from

2 participants

@0x000000

The main purpose of this pull request is to enable behaviour like #1067 for Rails 2.x

I am not very familiar with TestUnit, so please let me know about any problem with tests.

test/integration/recoverable_test.rb
@@ -32,6 +32,12 @@ def reset_password(options={}, &block)
click_button 'Change my password'
end
+ def redefine_after_reset_password_path
+ PasswordsController.send :define_method, :after_sending_reset_password_instructions_path_for do |r_name|
@josevalim Owner

Unfortunately if you do this, you will change the global state which may affect other tests.

We usually don't test such hooks, so feel free to skip the tests.

Jose, thank you for helping! I've skipped my test.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
@josevalim josevalim merged commit f2cd983 into plataformatec:v1.0
@josevalim
Owner

Thanks. However, I won't release a new gem, so please use a git dependency (or update to Rails 3 :D)!

@0x000000

Thank you! We will use git dependency in Gemfile.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
This page is out of date. Refresh to see the latest.
Showing with 7 additions and 1 deletion.
  1. +7 −1 app/controllers/passwords_controller.rb
View
8 app/controllers/passwords_controller.rb
@@ -14,7 +14,7 @@ def create
if resource.errors.empty?
set_flash_message :notice, :send_instructions
- redirect_to new_session_path(resource_name)
+ redirect_to after_sending_reset_password_instructions_path_for(resource_name)
else
render_with_scope :new
end
@@ -38,4 +38,10 @@ def update
render_with_scope :edit
end
end
+
+ protected
+
+ def after_sending_reset_password_instructions_path_for(resource_name)
+ new_session_path(resource_name)
+ end
end
Something went wrong with that request. Please try again.