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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T03:36:50+00:00 2026-05-15T03:36:50+00:00

I have an engine which defines some models and controllers. I want to be

  • 0

I have an engine which defines some models and controllers. I want to be able to extend functionality of some models/controllers in my application (eg. adding methods) without loosing the original model/controller functionality from engine. Everywhere I read that you simply need to define controller with the same name in your application and Rails will automatically merge them, however it doesn’t work for me and controller in engine is simply ignored (I don’t think it’s even loaded).

  • 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-15T03:36:50+00:00Added an answer on May 15, 2026 at 3:36 am

    Just if anyone else runs into same issue some time in the future, this is the code I wrote that fixed my problem:

    module ActiveSupport::Dependencies
      alias_method :require_or_load_without_multiple, :require_or_load
      def require_or_load(file_name, const_path = nil)
        if file_name.starts_with?(RAILS_ROOT + '/app')
          relative_name = file_name.gsub(RAILS_ROOT, '')
          @engine_paths ||= Rails::Initializer.new(Rails.configuration).plugin_loader.engines.collect {|plugin| plugin.directory }
          @engine_paths.each do |path|
            engine_file = File.join(path, relative_name)
            require_or_load_without_multiple(engine_file, const_path) if File.file?(engine_file)
          end
        end
        require_or_load_without_multiple(file_name, const_path)
      end
    end
    

    This will automatically require files from engine before requiring from application if file path starts with ‘app’.

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

Sidebar

Related Questions

I use Spark View Engine with nested master pages. I have Application.spark which defines
I have been working on a scheduler engine which reads schedule Jobs from a
I have a engine style Rails plugin from which I can create a gem
I have a school project in which we're going to write a financial engine
I have a table A which references table B. edit: Database engine used is
i am working on voxel based game engine, in which i need to have
Is it good idea to have application engine written in c++ and user interface
I have a Rails engine that defines a class method top(count) on a model
I Have an engine in vendor/plugins. My problem is, that i seemingly can´t extend
I'm trying to port some functionality from my engine from c++ to C#. I

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.