Contact US

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Problems referencing code in bundled gems

Problems referencing code in bundled gems

Problems referencing code in bundled gems

I'm working on my first gem and I'm having a problem referencing dependencies. In my gem, I need to reference code from some other custom gems we've developed.
We'll call my Gem "test_company_models". In my test_company_models gem, I need to include PricingExtensions from our test_company_libs Gem.

I'm dynamically requiring my models in my test_company_models.rb this way:


Dir[File.join(File.dirname(__FILE__), '/test_company_models/*.rb')].each do |file|
  # skip previously loaded files to avoid duplicate warnings
  next if File.basename(file, File.extname(file)) == 'version'
  require File.join( File.dirname(__FILE__), "vst_models/#{File.basename(file, File.extname(file))}")

This works fine until I am pulling in a model which references PricingExtensions from the test_company_libs Gem:


class CartItem < ActiveRecord::Base
  include PricingExtensions 

Which gives me this error:


uninitialized constant CartItem::PricingExtensions 

I've tried adding the test_company_libs Gem to my Gem in these two ways:



gem 'test_company_libs', :git => 'git@github.com:test_company/test_company-libs.git', :require => false 

and in the test_company_models.gemspec:


spec.add_runtime_dependency "test_company_libs" 

In either case, I get the "uninitialized constant CartItem::PricingExtensions" error.

Any idea as to what I am doing wrong?


Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close