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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T13:43:24+00:00 2026-05-23T13:43:24+00:00

Still a rails and ruby newbie, and I’m trying to figure out why adding

  • 0

Still a rails and ruby newbie, and I’m trying to figure out why adding ‘super’ fixed a problem I was having. (Was actually just a dumb guess to try ‘super’ so I have zero understanding why it now works.)

My rails 3 app uses Devise, and needed to “stuff” certain fields on the registration form if they are specified on the URL…

For example my normal registration url is

http://localhost:3000/users/register

which displays a blank signup form.

What I’m doing is having the url

http://localhost:3000/users/register?referral_code=ABCDEF

display the registration form, but with the referral_code field already filled in.

I already had a custom devise registration controller working (because I needed to redirect to a custom “check your email” page after a new user signs up before they have clicked their email confirm link). My routes.rb is therefore modified to:

devise_for :users, :path_names => { :sign_up => "register"}, 
:controllers => { :registrations => "registrations" }

and my simple custom devise registrations controller currently looks like:

class RegistrationsController < Devise::RegistrationsController 
  def new
    unless params[:refer].nil?
      @initial_referred_by = params[:refer].upcase
    end
    super
  end

  protected   

  def after_inactive_sign_up_path_for(resource)
     "/setup_awaiting_confirmation"
  end
end

Before I added ‘super’ to my custom ‘new’ method, the view would throw an error about missing ‘error’ method on the line of the view code that displayed devise_error_messages!

On one hand, I’m glad it works now. But I’d really like to have some understanding of what it actually happening here — why ‘super’ was ne cessary and what it’s doing — as I try to come up to speed on ruby+rails.

I wrote lots of other controller methods and never had ot use it, so I think it has something to do with my method needing to ‘call’ the underlying (or over-lying?) devise method also?

  • 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-23T13:43:24+00:00Added an answer on May 23, 2026 at 1:43 pm

    super keyword is inserting code from original implementation of method when it’s re-defined (in this case, it inserts Devise::RegistrationsController.new method). It was probaly needed because required handling of things in view requires that original code. If something’s still unclear, please ask.

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

Sidebar

Related Questions

I'm just starting out in Ruby (Rails actually) and the book I'm reading covers
Apologies -- I'm a newbie using Ruby on Rails. Still a little confused about
While I'm not a complete Ruby/Rails newb, I'm still pretty green and I'm trying
I have the following code. I'm still a newbie in Ruby on Rails. As
I'm still new to Ruby on Rails and I'm currently having a issue with
I have done some work with Ruby on Rails but am still not comfortable
I'm a 80% ruby on rails developer, but still need to do some Access
Still new to Objective C, and I'm having some trouble that I just can't
I'm still a beginner with ruby and rails, and now I'm googling about methods
I'm a ruby/haml/sass-beginner. I just installed ruby and rails for windows, haml, and sass

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.