LoginSignup
29
30

More than 5 years have passed since last update.

Rails4から--binstubsが使えなくなる件

Posted at

Rails4を試そうと思って、いつもどおりbundle install --binstubsしたらrails srails new扱いされてうまくいかなかった。

原因

ここによると、以前のscripts/railsbin/railsに移動したみたいです。

bin/railsrails sとかrails cとかのコマンドができるようになったため、いつものノリで--binstubsすると新bin/railsが上書きされてしまい、rails sなどがうまくいかなくなるようです。

対策

とはいえ、bundle exec rails sと打つのがめんどくさいので、RVMのafter_cd_bundlerフックを活用できるように.bundle/configに以下の設定を追加します。

.bundle/config
BUNDLE_BIN: bin

これbin/以下に自動でパスが通るようになりますので、rails sでちゃんとうごくようになります。

RVMのafter_cd_bundlerについては昔の投稿を参照してください。

Rails以外のgemについては最新のBundlerを使うことでbin/以下に実行スクリプトを生成できるようになります。

$ gem install bundler --pre
$ bundle --version
Bundler version 1.3.0.pre.7
$ bundle binstubs puma

bundle binstubs pumabin/pumaが生成されます。

29
30
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
29
30