where is devise implementation of “authenticate_user!” method?

It’s in lib/devise/controllers/helpers.rb1 and is generated dynamically (user being only one of the possible suffixes): def self.define_helpers(mapping) #:nodoc: mapping = mapping.name class_eval <<-METHODS, __FILE__, __LINE__ + 1 def authenticate_#{mapping}!(opts={}) opts[:scope] = :#{mapping} warden.authenticate!(opts) if !devise_controller? || opts.delete(:force) end def #{mapping}_signed_in? !!current_#{mapping} end def current_#{mapping} @current_#{mapping} ||= warden.authenticate(:scope => :#{mapping}) end def #{mapping}_session current_#{mapping} && warden.session(:#{mapping}) … Read more

different layout for sign_in action in devise

Another way to apply custom layout for an action is as following. According to How To: Create custom layouts “You can also set the layout for specific Devise controllers using a callback in config/environment.rb (rails 2) or config/application.rb (rails 3). This needs to be done in a to_prepare callback because it’s executed once in production … Read more

Setting Devise Login to be root page

To follow on from the people who are asking about the error Could not find devise mapping for path “https://stackoverflow.com/” there is a workaround. You’ll find that there is a clue in your logs which will probably say: [Devise] Could not find devise mapping for path “https://stackoverflow.com/”. This may happen for two reasons: 1) You … Read more

rails – Devise – Handling – devise_error_messages

I’m trying to figure this out myself. I just found this issue logged on Github https://github.com/plataformatec/devise/issues/issue/504/#comment_574788 Jose is saying that devise_error_messsages! method is just a stub (though it contains implementation) and that we’re supposed to override/replace it. It would have been nice if this was pointed out somewhere in the wiki, which is why i … Read more