mardi 5 mai 2015

Ruby on rails access Devise.sign_in_after_reset_password in a controller

Im overriding Devise's Devise::PasswordsController, so i can use it as a RESTful web service. For that, i've overridden all four methods (new, create, edit and update), based in devise's original Devise::PasswordsController class. It's been straight forward except for the update method, which uses a devise attribute called Devise.sign_in_after_reset_password. I've found that it is defined in the library module, but when I try to access it, i get the following error:

NoMethodError in Api::V1::PasswordsController#update

undefined method `sign_in_after_reset_password' for Devise:Module

Extracted source (around line #37):
36    resource.unlock_access! if unlockable?(resource)
37    if Devise.sign_in_after_reset_password
38      flash_message = resource.active_for_authentication? ? :updated : :updated_not_active
39      set_flash_message(:notice, flash_message) if is_flashing_format?
40      sign_in(resource_name, resource)

So far, I tried to require 'devise', but it didn't work. I googled it for a while, but didn't find anything either. Im kind of new to ruby and to ruby on rails, so I don't really know where to look. Any help would be very appreciated. Im using RoR 4.2.1 and Ruby 2.2.1 (2015-02-26)

Aucun commentaire:

Enregistrer un commentaire