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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T20:37:11+00:00 2026-05-27T20:37:11+00:00

I have a strange behavior of Rails 3.0.10. Got this application controller: app/controllers/application_controller.rb require

  • 0

I have a strange behavior of Rails 3.0.10. Got this application controller:

app/controllers/application_controller.rb

require 'api/api_controller'

# rest not important

app/controllers/api/api_controller.rb

class Api::ApiController < ActionController::Base
   before_filter :require_user

  def require_user
    @user = User.find(xxx, yyy)
  end
end

and then this controller:

app/controllers/api/ac_controller.rb

class Api::AcController < Api::ApiController

  before_filter :find_pool, :only => [:add_pool, :remove_pool]

  def add_pool
    # some logic that needs @user to be set
  end

  def remove_pool
    # some logic that needs @user to be set
  end

  def find_pool
    # some logic here
  end

end

My problem is when I run this in production mode the require_user filter is NOT called. When I try this in the development mode, it works.

Now, I understand in development mode classes are being reloaded, but the question is why the require_user filter does NOT get called?

Edit: Please note AC controller is before API controller lexicographically.

  • 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-27T20:37:11+00:00Added an answer on May 27, 2026 at 8:37 pm

    It looks like order of required files problem or the ApiController being loaded twice. Once before AcController and one more time after AcController being loaded. This could cause, that find_pool filter will get evaluated before require_user. ApiController is alse after AcController in lex order.

    The problem might be caused by require "api_controller" being present somewhere – it should be handled by Rails and does not need to be put down explicitly. So if there is such a line, removing it could help.

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

Sidebar

Related Questions

I have a simple HTML (as HTA) application that shows strange behavior on Windows
I have some strange behavior occurring in an ASP.NET application that I am trying
I have a strange behavior with PHP system function. In this php script there
I have some strange behavior in my iphone app. I have an NSTimer which
I have some strange behavior in my rails3 app. When I pick a date
I'm building a rails application and have come across what seems to be strange
I have this extremely strange behavior coming : In the below code: If I
I have run into some strange behavior. I am not sure if this should
Currently i have a strange behavior in my WPF Application. I have a Main
I have a very strange behavior when I got mutations in a node in

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.