Updating controllers to scope resource_class and changing mapping implementation to reload mapped class based on cache_classes configuration.

This commit is contained in:
Carlos A. da Silva
2009-10-10 11:05:56 -03:00
parent 2fbb56e8f7
commit aefa857ab2
5 changed files with 52 additions and 28 deletions

View File

@@ -10,7 +10,7 @@ class PasswordsController < ApplicationController
# POST /password
#
def create
self.resource = User.send_reset_password_instructions(params[resource_name])
self.resource = resource_class.send_reset_password_instructions(params[resource_name])
if resource.errors.empty?
flash[:notice] = I18n.t(:send_instructions, :scope => [:devise, :passwords], :default => 'You will receive an email with instructions about how to reset your password in a few minutes.')
redirect_to new_session_path
@@ -22,14 +22,14 @@ class PasswordsController < ApplicationController
# GET /password/edit?perishable_token=abcdef
#
def edit
self.resource = User.new
self.resource = resource_class.new
resource.perishable_token = params[:perishable_token]
end
# PUT /password
#
def update
self.resource = User.reset_password!(params[resource_name])
self.resource = resource_class.reset_password!(params[resource_name])
if resource.errors.empty?
flash[:notice] = I18n.t(:update, :scope => [:devise, :passwords], :default => 'Your password was changed successfully.')
redirect_to new_session_path