[Rails] Problems referencing code in bundled gems
Hello,
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:
[code]
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))}")
end
[/code]
This works fine until I am pulling in a model which references
PricingExtensions from the test_company_libs Gem:
[code]
class CartItem < ActiveRecord::Base
include PricingExtensions
[/code]
Which gives me this error:
[code]
uninitialized constant CartItem::PricingExtensions
[/code]
I've tried adding the test_company_libs Gem to my Gem in these two ways:
Gemfile:
[code]
gem 'test_company_libs', :git =>
'git@github.com:test_company/test_company-libs.git', :require => false
[/code]
and in the test_company_models.gemspec:
[code]
spec.add_runtime_dependency "test_company_libs"
[/code]
In either case, I get the "uninitialized constant
CartItem::PricingExtensions" error.
Any idea as to what I am doing wrong?
Thanks,
Eric
--
Posted via http://www.ruby-forum.com/.
--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/53a919d26e319ad0775945bb6947a268%40ruby-forum.com.
For more options, visit https://groups.google.com/groups/opt_out.
0 Comments:
Post a Comment
Subscribe to Post Comments [Atom]
<< Home