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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T10:39:29+00:00 2026-05-24T10:39:29+00:00

I have a Rails 3 app that I am turning into a Rails engine

  • 0

I have a Rails 3 app that I am turning into a Rails engine / gem.
This engine has some gem dependencies that I have put inside it’s .gemspec file.

I have created a new ‘parent’ Rails 3 app, and I would like to add my engine gem to the Gemfile and have the gem’s dependencies automatically ‘loaded’, but this does not work for me! bundle install installs the gem dependencies fine, but when I start the server, the app crashes because they are not loaded.

For example, my engine’s gemspec contains these lines:

s.add_runtime_dependency(%q<rails>, ["= 3.0.7"])
s.add_runtime_dependency(%q<acts_as_commentable>, [">= 3.0.1"])
s.add_runtime_dependency(%q<haml>, [">= 3.1.1"])

.. and the parent Rails 3 application has these lines in its Gemfile:

source 'http://rubygems.org'

gem 'my_engine', :path => "~/src/gems/my_engine"

But I get the following error:

undefined local variable or method `acts_as_commentable'
from /home/user/src/gems/my_engine/app/models/account.rb:66:in `<class:Account>'

But if I add gem 'acts_as_commentable', '>= 3.0.1' to the Gemfile of the parent Rails 3 app, then the gem is loaded and the error disappears.

I am using Rails 3.0.8.

Does anyone have any suggestions? Do I need to change something about the way my engine is loading?

  • 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-24T10:39:29+00:00Added an answer on May 24, 2026 at 10:39 am

    During main Rails app boot, Bundler will only require dependencies directly listed in the Gemfile but not any sub-dependencies. It’s your library’s/Engine’s responsibility to require its dependencies when it itself gets required. You can do so using initializers in your Railtie.

    class MyRailtie < Rails::Railtie
      initializer "require stuff" do
        require "stuff"
      end
    end
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

We have a Rails app that has some pages that are available to all
I have a rails app that has some simple functionality, allowing the user to
I have a rails app that has picked up a bit of traction, but
I have a Rails app that will post some data to another Rails app.
I have a rails app that has asynchronous processing, and I'm having trouble getting
I have a rails app that has approx 30 matches in routes.rb match '/send-email'
I have a rails app that I am looking into implementing videos. I know
I have a Rails app that saves files in mongo. This works great and
I have a rails app that needs a lot of initial data. This data
I have a rails app that consists of lots of accounts. Inside these accounts

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.