Forum: Ruby on Rails Using gems from vendor/ ?

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
55fd56dfef815d7aa543be09ad3ed3e9?d=identicon&s=25 Kamil Kisiel (Guest)
on 2006-01-04 03:13
(Received via mailing list)
Maybe someone here can help me out. I've unpacked tzinfo in to my
vendor/ directory using "gem unpack tzinfo" and got a
vendor/tzinfo-0.1.1 directory as a result. How can I require this gem in
my app? I'm trying to use a require line in my environment.rb but no
matter what I do Rails seems to look for a locally installed copy in
/usr/local/ instead. Any advice?
9ab183bb240ffd3a3966d5a615b4bdeb?d=identicon&s=25 Philip Ross (Guest)
on 2006-01-04 18:12
(Received via mailing list)
Kamil Kisiel wrote:
> Maybe someone here can help me out. I've unpacked tzinfo in to my
> vendor/ directory using "gem unpack tzinfo" and got a
> vendor/tzinfo-0.1.1 directory as a result. How can I require this gem in
> my app? I'm trying to use a require line in my environment.rb but no
> matter what I do Rails seems to look for a locally installed copy in
> /usr/local/ instead. Any advice?

Require isn't working because the tzinfo.rb file in tzinfo-0.1.1/lib
doesn't add its directory to the load path at the moment. I'll look at
making a change to do this in a future release.

For now, you can add tzinfo-0.1.1/lib to the load path manually using
config.load_paths in environment.rb:

config.load_paths += %W( #{RAILS_ROOT}/vendor/tzinfo-0.1.1/lib )

You should then be able to require 'tzinfo' and have it load the copy
from vendor.

Phil

--
Philip Ross
http://tzinfo.rubyforge.org/ -- DST-aware timezone library for Ruby
55fd56dfef815d7aa543be09ad3ed3e9?d=identicon&s=25 Kamil Kisiel (Guest)
on 2006-01-04 21:45
(Received via mailing list)
Philip Ross wrote:
> Require isn't working because the tzinfo.rb file in tzinfo-0.1.1/lib
>
> Phil
>

Thanks Philip, I'll give this a try. Maybe you could also include this
information on the website as well? It would probably help save some
others from similar frustration :)

Kamil
This topic is locked and can not be replied to.