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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T22:10:30+00:00 2026-05-22T22:10:30+00:00

Rails loads controllers, helpers and models on each request. My controllers have a bunch

  • 0

Rails loads controllers, helpers and models on each request.

My controllers have a bunch of modules which include methods for shared actions

Each time I change the modules, I have to restart Rails for the changes in the actions to take effect

Any idea how I can tell rails to reload these modules too?


Update:

My directory structure is like so:

  app/
    controllers/
      app1/
        users_controller.rb
      app2/
        users_controller.rb

  lib/
    templates/
      controllers/
        users_controller_template.rb

Both App1::UsersController and App2::UsersController load UsersControllerTeplate like so:

# app/controllers/app1/users_controller.rb
class App1::UsersController < App1::ApplicationController
  require "templates/controllers/users_controller_template"
  include Templates::Controllers::UsersControllerTemplate
end

# templates/controllers/users_controller_template.rb
module Templates::Controllers::UsersControllerTemplate

  def self.included(base)
    base.class_eval do
      # some class macros called here
    end
  end
  
  # actions defined here
  def index
  end

end

In application.rb I’ve added:

config.autoload_paths += %W{ #{config.root}/lib/templates/ }

But I still have to reload the server to see changes made in users_controller_template.rb

Any ideas?

  • 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-22T22:10:31+00:00Added an answer on May 22, 2026 at 10:10 pm

    You can add them to your autoload_paths in your application.rb file and they will be re-loaded automatically along with the models and controllers.

    config.autoload_paths << "#{config.root}/lib"
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a Ruby on Rails page that loads another page using jquery. I
I have a rails app that creates a kml file and successfully loads it
I have a Rails Engine gem in which I want to load a HomeController
I have a partial in my rails app that loads the vote form (It's
I have a Ruby script in my Rails app that I use to load
Rails comes with a handy session hash into which we can cram stuff to
Rails introduced some core extensions to Ruby like 3.days.from_now which returns, as you'd expect
Rails is a great platform, but it just doesn't have the history that Perl
Rails has a nice idiom that makes it easy for you to have a
Mac OSX 10.7.2, Following a rails tutorial and have come to an error when:

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.