2

I'm just starting Rails dev by using Michael Hartl's walkthrough and have hit a snag.

My shared hosting that I'm using uses CPanel which has a bug where it can't work with Rails 3. There is supposed to be an update (CPanel 11.34) coming out within the next 6 months that is supposed to fix this.

The version my host uses is Rails 2.3.14.

Obviously there is going to be a world of difference between 2.3.14 and 3/3.2

I'm in Australia which doesn't have an equivalent to Heroku or EngineYard and I need Australian hosting as the data my app will consume/output needs to stay in Australia.

First question is can someone point me at the right direction re limiting my dev environment to the same version as my host? I'm not concerned with multiple versions using rvm. Is it just the freeze command?

Second question is what are the downfalls in developing for the old version? Obviously I'll need to migrate when 3.0 is available on the webhost. Are there any features/specifics that are showstoppers in terms of developing for 2.3.14?

Any help much appreciated

4

2 回答 2

2

您仍然可以在 2.3 中使用bundler - 这可以很容易地将自己限制在特定版本的 gems 中,包括 rails 本身。

我想不出很多你不能用 2.3.x 做的事情,显然当时人们也很高兴地编写 web 应用程序。3.x 系列中有很多新东西:资产管道、可挂载引擎、更容易使用不同的 ORM 或 javascript 库、新的路由 api、新的基于 arel 的活动记录等。内部也有很多变化使第 3 方更容易编写扩展 rails 或提供身份验证等功能切片的 gem。

没有太大变化,但 2.3 与 3.x 的一个重要事实是 2.3 已不再使用:编写有用的 gem(carrierwave、devise、factory girl 等)或教程的人经常只针对或不再针对 3.x维护他们的 2.x 版本。

于 2012-04-18T08:28:48.407 回答
0

第二个问题是旧版本开发的缺点是什么?

一方面,您必须小心不要使用 2.3.x 中不可用的 ActiveRecord 功能。例如,在 3.x 中,您可以执行以下操作:

 Client.where("orders_count = ?", params[:orders])

但在 2.3.x 中,您必须这样做:

 Client.first(:conditions => ["orders_count = ?", params[:orders]])

在 2.3.x 中,您也不能链接查询方法来构建查询。

于 2012-04-18T03:07:10.397 回答