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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T12:50:04+00:00 2026-05-27T12:50:04+00:00

I recently switched from the gem version of resources_controller to a plugin as the

  • 0

I recently switched from the gem version of resources_controller to a plugin as the gem version relied on git.

Inside the vendor/plugins/plugin/lib/plugin.rb file, the Railtie is as follows:

module Ardes
  module ResourcesController
    class Railtie < Rails::Railtie
      initializer 'ardes.resources_controller' do
        ActiveSupport.on_load(:action_controller) do
          extend Ardes::ResourcesController
          include Ardes::ResourcesController::RequestPathIntrospection
        end

        ActiveSupport.on_load(:active_record) do
          include Ardes::ActiveRecord::Saved
        end
      end
    end
  end
end

I’ve added a require 'resources_controller' in one of my initializers and it’s properly loading this file. The problem is that although the Railtie is evaluated (a puts in the class block will hit), it never seems to actually call the initializer block itself. This is important of course as this is where it extends ActionController to include the resources_controller_for method.

This question is appears to have come up here and here. Though in both cases they found other ways around the problem and no direct answer was given for why the block wasn’t being called.

From what I can tell in the Rails docs you can name your initializer block anything you’d like and it should run. I don’t think it matters, but I first noticed the problem when running in production rails s -e production though I believe the same problem exists in development mode.

What may be going on?

For reference, full plugin is here: https://github.com/ianwhite/resources_controller

  • 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-27T12:50:05+00:00Added an answer on May 27, 2026 at 12:50 pm

    The problem you’re having here is that you can’t add new initializers once the initializer process has started.

    Here, you’re requiring the code that registers the initializers during the initializer process. When you use gems in the Gemfile, the initializers are registered in this code:

    if defined?(Bundler)
      # If you precompile assets before deploying to production, use this line
      Bundler.require(*Rails.groups(:assets => %w(development test)))
      # If you want your assets lazily compiled in production, use this line
      # Bundler.require(:default, :assets, Rails.env)
    end
    

    This code executes before the initializers begin. In contrast, you are requiring the resources_controller code in an initializer file, which runs during the initialization process. As a result, it’s too late to register new initializers.

    What complicates the situation is that the load paths inside vendor/plugins are also set up during the initialization process, so you won’t be able to require resources_controller in application.rb.

    The easiest solution to your problem would be to use the :path feature in bundler. After installing the plugin, add this line to your Gemfile:

    gem 'resources_controller', :path => "vendor/plugins/resources_controller"
    

    You can then remove the require line from your initializer, and bundler will recognize that the plugin is a locally checked out gem and do what it would do if you used git.

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

Sidebar

Related Questions

We recently switched from SVN to Git and re-configured our ccnet server. Everything is
I recently switched from using kqueue to GCD dispatch sources to monitor file changes.
I recently switched from a Java based project to a C#/.net project. I previously
I recently switched from using Linq to Sql to the Entity Framework. One of
I've recently switched from being an employee of a small consulting company to being
I've recently switched from storing session data in a cookie to storing it in
We recently switched our Windows software packages from RPM (cygwin) to MSI (wix). Having
We recently switched some of our sites from deflate to gzip and noticed a
Recently, I switched from Visual Studio to Eclipse CDT. I've set it up beautifully
I recently switched from restful_authentication to authlogic for authenticating users for my application. I've

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.