Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9181915
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T18:26:07+00:00 2026-06-17T18:26:07+00:00

I use devise in my application. I want to pop-up a welcome message while

  • 0

I use devise in my application.

I want to pop-up a welcome message while the user login.

so in my application_controller.erb I defined:

class ApplicationController < ActionController::Base
  protect_from_forgery
  before_filter :authenticate_user!

  def after_sign_in_path_for(user)
    alert('Welcome!')
  end

  def after_sign_out_path_for(user)
    new_user_session_path
  end
end

when I tried to sign-in to my app, I got an error:

ArgumentError in Devise::SessionsController#create

wrong number of arguments (1 for 0)
Rails.root: /home/alon/alon/todolist

Application Trace | Framework Trace | Full Trace
app/controllers/application_controller.rb:14:in `after_sign_in_path_for'
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T18:26:09+00:00Added an answer on June 17, 2026 at 6:26 pm

    By default devise adds flash messages. No need to set the flash message.Just you need to display the flash message in the view. Try the below code.

    in your app/views/layouts/application.html.erb

    <% flash.each do |type, message| %>
      <div class="flash">
         <%= message %>
      </div>        
    <% end %> 
    

    FYI after_sign_in_path_for is not for setting the flash message. Its the just to inform the path to devise where you want to redirect the application after successful login.

    Lets set the successful login redirect path

    in you config/routes.rb

    match "users/dashboard" => "controllername#action"
    

    And finally change the after_sign_in_path_for method

    def after_sign_in_path_for(user)
      users_dashboard_path
    end
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to use token_authenticatable in my application (using Devise). Using this answer I
I want to block/unblock (where user can not use/access the blocked application) some application
I am using devise omniauth in my rails application, here is the User class
I use this link to put the login links on my application : https://github.com/plataformatec/devise/wiki/How-To:-Add-sign_in,-sign_out,-and-sign_up-links-to-your-layout-template
I use Devise in Rails 3. I want to see name of current_user in
I want to use devise's tokens to support logging in/out in multiple clients at
I have two models User and Admin(with RailsAdmin) that use Devise. I sign in
I set up a rails 3.2.11 application using Devise for authentication. I want to
I'm developing Rails application and I have to use authentication. I installed devise gem
I have an application where we want the user to either be able to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.