How to avoid 'no such file to load — map_by_method' script/console with bundler?

狂风中的少年 提交于 2019-12-10 16:16:24

问题


I am running rails 2.3.10 with bundler. I use rvm, in global gemsets usually I put the gems useful for the irb. By default I had these there: map_by_method, what_methods, ap, net-http-spy, hirb, looksee, pp, wirble.

When I start irb, the gems it needs are avalaible for it, and the things look as they should. However, when I start script/console, it cannot reach the gems in the current rvm gemset only those which are defined in Gemfile. I get message no such file to load -- map_by_method. Obviously I do not want to put those irb specific files to my Gemfile.

Do you know some way, how to convince script/console to use also gems outside bundler?


回答1:


bundler will never use any gem that is not defined in the Gemfile. If those gems are for development use only consider adding them to the Gemfile in a group called :development




回答2:


You can hand-require gems from within script console if you need them:

$ script/console
=> require 'rubygems'
=> require 'mygem'
=> include 'MyGem::Stuff'


来源:https://stackoverflow.com/questions/4408313/how-to-avoid-no-such-file-to-load-map-by-method-script-console-with-bundler

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!