简体   繁体   English

Ruby on Rails:rails和bin / rails之间的4.2.0差异

[英]Ruby on Rails: 4.2.0 differences between rails and bin/rails

So starting from Rails 4.1.x there seems to be a recommended way to use rails under the application folder. 所以从Rails 4.1.x开始,似乎有一种推荐的方法在应用程序文件夹下使用rails。 Instead of the traditional: 而不是传统的:

rails server

it is recommended by Rails official guide to use 它是由Rails官方指南推荐使用的

bin/rails server

It looks like the bin/rails is referencing rails with additional stuff. 它看起来像bin / rails用其他东西引用rails。 What would be the additional benefits of using bin/rails compared to rails? 与rails相比,使用bin / rails有什么额外的好处?

A second question is - I was used to use rails server, rails console, etc. rather than bin/rails server, bin/rails console. 第二个问题是 - 我习惯使用rails服务器,rails控制台等,而不是bin / rails服务器,bin / rails控制台。 Without using bin/rails, would I lose anything (like misloading some libs, etc.)? 如果不使用bin / rails,我会丢失任何东西(比如误载一些lib等)?

Thanks. 谢谢。

Put the following line in your bin/rails file: puts "In the bin/rails file" 将以下行放在bin / rails文件中: puts "In the bin/rails file"

Now run rails server . 现在运行rails server You'll likely see that the rails command is executing the bin/rails file. 您可能会看到rails命令正在执行bin/rails文件。

I'm guessing the official guide suggests using bin/rails for two reasons: 我猜这个官方指南建议使用bin/rails有两个原因:

  1. Avoid using another instance of rails if your paths are not set up properly. 如果路径设置不正确,请避免使用另一个rails实例。
  2. Speed - bin/rails seems to be a bit faster than just rails 速度 - bin/rails似乎比rails快一点

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM