开发者

Changing Gemfile to Match Hosting Sever's Gems

Many shared hosts restrict you to use certain gems. When installing a Rails app developed on a different machine to a shared hosting server, often times you need to tell your app to use a different version of a gem than what the original development app used.

Let's pretend that the development app used RMagick 2.13.0, and your hosting server only has 2.开发者_JAVA百科12.0. You can do this a couple ways, you could modify Gemfile.lock to point to the gem installed on the system, or you can change the Gemfile itself to require the specific gem version:

gem "rmagick", "=2.12.0"

Is there a preferred method to doing this?


Use the precise version on your development machine as you will be deploying to on your shared hosting server.

The syntax you have in your question is the preferred method of binding gems to a precise version.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜