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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T21:40:54+00:00 2026-06-06T21:40:54+00:00

I am getting this error: Routing Error uninitialized constant RegistrationsController This is my log:

  • 0

I am getting this error:

Routing Error
uninitialized constant RegistrationsController

This is my log:

Started GET "/registrants/1/registrations/new" for 127.0.0.1 at 2012-07-03 00:55:44 -0500

ActionController::RoutingError (uninitialized constant RegistrationsController):

Rendered /.rvm/gems/ruby-1.9.2-p0/gems/actionpack-3.1.3/lib/action_dispatch/middleware/templates/rescues/routing_error.erb within rescues/layout (8.5ms)

This is the part of my routes.rb that is appropriate:

registrant_registrations GET    /registrants/:registrant_id/registrations(.:format)          {:action=>"index", :controller=>"registrations"}
                                   POST   /registrants/:registrant_id/registrations(.:format)          {:action=>"create", :controller=>"registrations"}
       new_registrant_registration GET    /registrants/:registrant_id/registrations/new(.:format)      {:action=>"new", :controller=>"registrations"}
      edit_registrant_registration GET    /registrants/:registrant_id/registrations/:id/edit(.:format) {:action=>"edit", :controller=>"registrations"}
           registrant_registration GET    /registrants/:registrant_id/registrations/:id(.:format)      {:action=>"show", :controller=>"registrations"}
                                   PUT    /registrants/:registrant_id/registrations/:id(.:format)      {:action=>"update", :controller=>"registrations"}

This is my Registrations Controller, which is at /app/controllers/portal/registrations_controller.rb:

class Portal::RegistrationsController < ApplicationController
  def create
        @registrant = current_member.registrants.find(params[:registrant])
        @registration = @registrant.registrations.build

        respond_to do |format|
          if @registration.save
            format.html {   redirect_to root_path, :notice => "Registration successfully created!" }
            format.json { head :ok }
          else
           format.html { redirect_to root_path, :notice => "There was a problem with the registration." }
          end
        end     
  end

end

I get this error when I call new_registrant_registration_path(registrant) from a view in Portal#index.

Edit:

For completeness, here is my routes.rb file in its entirety before the solution was found. Radar mentioned the gist I posted, but I figured I would put the code here in case that gist is deleted.

MyApp::Application.routes.draw do

  match 'admin' => 'admin/dashboard#index', :as => :admin_root
  match 'portal' => 'portal#index', :as => :member_root

  namespace 'admin' do
    match 'profile' => 'profile#show', :as => :profile

    resources :members
    resources :admins
        resources :packages
        resources :products
        resources :levels
        resources :lessons
        resources :registrations
        resources :registrants, :controller => 'customers/registrants'
        resources :locations
        resources :schools
        resources :terms
        resources :customers
        resources :invoices
        resources :payments
  end

  namespace 'member' do
    resources :registrations
  end

  match 'register' => 'member/registrations#new', :as => :signup  
  match 'login' => 'member_sessions#new', :as => :login
  match 'logout' => 'member_sessions#destroy', :as => :logout  
  match 'admin/login' => 'admin_sessions#new', :as => :admin_login
  match 'admin/logout' => 'admin_sessions#destroy', :as => :admin_logout

  match 'member/activate/:activation_code' => 'member/activations#create', :as => :member_activation
  match 'member/:id/activate/resend' => 'member/activations#resend', :as => :resend_member_activation
  match 'member/:id/activate' => 'member/activations#new', :as => :new_member_activation

  match 'member/password/reset/begin' => 'member/password_resets#new', :as => :new_member_password_reset, :via => :get
  match 'member/password/reset' => 'member/password_resets#create', :as => :member_password_resets, :via => :post
  match 'member/password/:token/finish' => 'member/password_resets#edit', :as => :edit_member_password_reset, :via => :get
  match 'member/password/reset' => 'member/password_resets#update', :as => :member_password_reset, :via => :put

  match 'admin/packages/new/:partial' => 'admin/packages#new'

  resources :admins

  resources :registrants, :controller => 'portal/registrants' do
    resources :registrations
  end

  resource :admin_session
  resource :member_session

  root :to => 'portal#index'

end
  • 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-06T21:40:56+00:00Added an answer on June 6, 2026 at 9:40 pm

    To make things clear: marcamillion came into #rubyonrails and Freenode and shared his config/routes.rb. That’s where I figured out the error that he was making and then figured out the answer.


    Two things.

    First: Admin root route

    Rather than defining the root route for your admin namespace like this:

    match 'admin' => 'admin/dashboard#index', :as => :admin_root
    

    Define it inside the namespace :admin call like this:

    namespace 'admin' do
      root :to => "dashboard#index"
    end
    

    This will automatically define it as admin_root_path and admin_root_url, so you won’t need to do that, and it will automatically prefix the controller with the admin/ prefix, so you won’t need to do that either.

    Second: Referencing RegistrantsController

    You have this currently in your config/routes.rb:

    resources :registrants, :controller => 'portal/registrants' do
      resources :registrations
    end
    

    What this will do is define resources routes for registrants correctly using the Portal::RegistrantsController, but won’t define the nested routes underneath this using Portal::RegistrationsController. What it will do is attempt to use RegistrationsController, which is why you’re getting that error.

    To fix this, I’d recommend you use the scope method, like this:

    scope :module => Portal do
     resources :registrants do
      resources :registrations
     end
    end
    

    The scope method, when used in this way, will tell Rails that the controllers for the routes inside the block are under the Portal namespace. This means that it will know that resources :registrants is for Portal::Registrants and that resources :registrations is for Portal::Registrations, thereby fixing the error that you’re seeing.

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

Sidebar

Related Questions

I keep getting this error when trying to view my channels controller. uninitialized constant
Im getting this routing error No route matches {:controller=>posts, :action=>show} when i click on
I'm getting this error for the URL http://localhost:3000/dashboard/ Routing Error No route matches /dashboard
I'm getting a rails routing error for a brand new image I just added.
I'm getting this JS error while trying to use Ember routing: Uncaught TypeError: Object
I just started getting this error when going to the Resque web ui on
Getting this error: 2009-09-03 12:44:02.307 xcodebuild[307:10b] warning: compiler 'com.apple.compilers.llvm.clang.1_0.analyzer' is based on missing compiler
Getting this error with jquery & jquery.form. Site has been live for awhile..upgraded to
Getting this error when try to add an item to my repositories/context: Collection has
Am getting this error message and matched my brackets and couldn't find anything wrong.

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.