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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T07:19:46+00:00 2026-06-05T07:19:46+00:00

When the global application controller is loaded first, the namespaced application controller does not

  • 0

When the global application controller is loaded first, the namespaced application controller does not load when loading pages within that namespace. The application controller looks like this:

class ApplicationController < ActionController::Base
 protect_from_forgery
end

And the namespaced application controller looks like this:

class Admin::ApplicationController < ApplicationController

def authenticate_admin!
 if current_admin.nil?
  redirect_to new_admin_session_url
 end
end

private

 def current_admin
  @current_admin ||= Admin.find(session[:admin_id]) if session[:admin_id]
 end

helper_method :current_admin
end

When we use the before_filter “authenticate_admin!” like this:

class Admin::AssetsController < Admin::ApplicationController
  before_filter :authenticate_admin!
end

A “NoMethodError in Admin::AssetsController#new” is thrown. This only occurs when we hit the global route before the namespaced route. If the server is restarted and the namespaced route is loaded first everything works properly.

  • 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-05T07:19:47+00:00Added an answer on June 5, 2026 at 7:19 am

    This is happening because you also happen to have an Admin model (a Class) with the same name as your namespace.

    This Google group thread provides a good explanation of what exactly is happening.

    To fix, I would either rename the model to AdminUser or if that is not a possibility, renaming the namespace will also fix the issue.

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

Sidebar

Related Questions

Somebody said that when your PHP code and application use global variables then it
I have develop a application that use a global keybord/mouse hook. It works perfect
I am developing an ASP.NET MVC application that has two kind of pages: (1)
I have a controller action that uses a static variable on Global.asax which is
I wish to load some global defaults in my CakePHP application. E.g. app/config/defaults.php $config['site']['name']='FooBar';
I have an application that I am using a global route to query for
In my global.css file which is loaded by application.html.erb , I have the following
Does the Application_Start in global.asax called when the new published code is kept in
Inside the Application_Start of my Global.asax.cs, I am trying to get the current application
I extended Application to store my global variables: public class MyApp extends Application{ private

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.