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 6563173
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T13:47:55+00:00 2026-05-25T13:47:55+00:00

I would like to create a profile after an user signs up for my

  • 0

I would like to create a profile after an user signs up for my site using Devise. So in User model, I add:
after_create :build_spec

def build_spec
  Spec.new(:user_id => :id)
end

I also have a views/layouts/_header.html.erb that has a link to Spec:

<%= link_to "Profile", spec_path(Spec.find_by_user_id(current_user.id)) %>

This creates trouble when an user just completed signup form and clicked sign up button. He will be directed to some page. At this moment, I think Spec object for this user has not been created, thus the link in the _header partial doesn’t work (nil object), and user got an error:

No route matches {:action=>"show", :controller=>"specs"}

(Obviously, I had SpecsController with action “show”)

My question is: How to I create Spec for signed-up user before he is redirected to the first page after the sign up (in order to make the link to Spec works)?

Comments and advices are much needed.

  • 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-05-25T13:47:55+00:00Added an answer on May 25, 2026 at 1:47 pm

    Override the after_sign_up action in the Devise RegistrationsController.

    https://github.com/plataformatec/devise/wiki/How-To:-Redirect-to-a-specific-page-on-successful-sign-up-%28registration%29

    Which would then look like this:

    class RegistrationsController < Devise::RegistrationsController
    protected
    
      def after_sign_up_path_for(resource)
        Spec.create(:user_id => resource.id)
        after_sign_in_path_for(resource)
      end
    end
    

    Then again, your method might work as well, if you just replaced Spec.new(:user_id => :id)
    by Spec.create(:user_id => :id)
    Spec.new just creates a new instance of Spec but does not actually save it.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I would like to create a user interface like the iGoogle or facebook profiles
I would like to create a mechanism for a User to keep track of
I would like to create a recurring payment profile with minute interval instead of
I'm using devise to do the new user registration. Right after a new user
I would like to create a registration page which takes user information and generates
After a user has provided me their oauth credentials, I would like to allow
I would like to create a profile page for every account created. Once created
i would like create a array of structure which have a dynamic array :
I would like to create a flash presentation for a web page. It would
I would like to create a COM object that runs in an out of

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.