Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>You have to override your custom failure devise Class. </p> <p>Add this custom failure class under lib/custom_failure.rb</p> <pre><code>class CustomFailure &lt; Devise::FailureApp def respond if http_auth? http_auth elsif warden_options[:recall] recall else redirect end end def redirect store_location! flash[:alert] = i18n_message unless flash[:notice] redirect_to "/" end def recall env["PATH_INFO"] = attempted_path flash.now[:alert] = i18n_message(:invalid) self.response = recall_controller.action(warden_options[:recall]).call(env) end protected def i18n_message(default = nil) message = warden.message || warden_options[:message] || default || :unauthenticated if message.is_a?(Symbol) I18n.t(:"#{scope}.#{message}", :resource_name =&gt; scope, :scope =&gt; "devise.failure", :default =&gt; [message, message.to_s]) else message.to_s end end def warden_options env['warden.options'] end def warden env['warden'] end def recall_controller "#{params[:controller].camelize}Controller".constantize end def attempted_path warden_options[:attempted_path] end def store_location! session[:"#{scope}_return_to"] = attempted_path if request.get? &amp;&amp; !http_auth? end def attempted_path warden_options[:attempted_path] end def http_auth? !Devise.navigational_formats.include?(request_format) || (request.xhr? &amp;&amp; Devise.http_authenticatable_on_xhr) end end </code></pre> <p>Write this under config/application.rb</p> <pre><code>config.autoload_paths += %W(#{config.root}/lib) </code></pre> <p>_________________Edit __________________</p> <p>You said when the 'sign up goes wrong', this means the control should be in registrations_controller <code>create</code> method. Something must be wrong there, I guess. Try to add these routes.</p> <pre><code>devise_for :users devise_scope :user do root :to =&gt; "devise/sessions#new" get "sign_in", :to =&gt; "devise/sessions#new" get "sign_out", :to =&gt; "devise/sessions#destroy" get "sign_up", :to =&gt; "devise/registrations#new" end </code></pre> <p>________________Edit 2 ________________</p> <p>Add this in views/devise/registrations/new.html.erb</p> <pre><code>&lt;%= devise_error_messages! %&gt; </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload