Should I use Ruby 1.9.2 with my new web app?

一个人想着一个人 提交于 2019-12-05 18:12:26

问题


Starting a new web app with Rails 3. I'm still relatively new to web development and have really enjoyed all the internet resources available to me while working in Ruby 1.8.7 and Rails 2.3.5. Any advice against using Ruby 1.9.2 on my new project?


回答1:


I have been successfully converting all my Rails projects (except one, but I'm working on it) from Ruby 1.8.7/Rails 2.3.5 to Rails 3.0.0 and Ruby 1.8.7/1.9.2 RC2 and both environments are pretty stable.

Fortunately, things changed since I posted this question.

Rails

Unless you really have something that prevents you to do that, I strongly encourage you to start with Rails 3. The effort required to upgrade an application from Rails 2 to Rails 3 should discourage you from starting from Rails 2.

Talking about plugins and Gems, many developers are starting to convert their libraries to Rails 3. Currently there's a very high level of compatibility. Furthermore, Rails 3 focused plugins tends to be quite more powerful to the Rails 2.3 ones, thanks to the new Rails plugin API. They can load tasks, they no longer abuse monkey patching or rely on internal hacks.

Also, Rails 3 is just around the corner. Unless your project will be deployed in 1 week, the stable version will probably available before you deploy your code. I this would not happe, consider that I'm currently managing a couple of Rails 3 project in a production environment and they are pretty stable (Rails 3 RC1, the Beta 4 has a really weird bug in the caching environment).

Ruby 1.9.2

Ruby 1.9.2 is way more powerful than Ruby 1.8.7. If this is a brand new project, I suggest you to use the 1.9 branch.

Usually, it's more easy to start a new project in Ruby 1.9 than converting an existing one.

Ruby 1.9.2 is faster, even more faster than REE. The most part of the common Ruby 1.8.7 Gems work with Ruby 1.9 except a few ones, such as RCov. Again, it's very hard you're going to need a library which doesn't work with Ruby 1.9.2.

If it happens, chances are this is an outdated library and a better replacement is probably available in the Ruby ecosystem.

If you can't find an alternative, remember that Rails 3 provides an excellent way to use custom libraries, thanks to Bundler. You can fork the project and ask Bundler to use your fork. You can even integrate the library in your repos and ask Bundler to load the library from a path.

Conclusion

From my personal experience, I've been very happy with Ruby 1.9.2 and Rails 3. This is by far my favorite environment and my default environment for new projects.

If you can't use Ruby 1.9.2 try with Ruby 1.8.7. On the other side, I strongly encourage you to start with Rails 3.




回答2:


It ultimately depends on what the project is. If it is a personal project, and you are using it as a means to learn Ruby/Rails, than I think it would be worth learning and using the latest tools. If this is client work, or a project that your main goal is just to complete the thing, 2.3.5 / 1.8.7 would probably be the best choice, because of resources as you mentioned, and a lot of supporting libraries/gems will just work. You will have to learn Rails 3 / Ruby 1.9.x at some point because that's definitely where the community is headed.

I would do some research and see what gems you will need for your project, and make sure that everything is supported if you choose the Rails 3 / 1.9.2 route. Also, join the irc and ask around about other people's experience with whatever gems are in question.

I can tell you that I have a small Rails 3 / 1.9.2 application that runs just fine in production, although it is very small and a personal project.




回答3:


You might want to try out Ruby 1.9.2 by using RVM

I've been using it off and on to develop some Rails3 apps while maintaining our current production sites (all the way down to Rails 2.2 / Ruby 1.8.5). Only gripe being having to remember to start RVM up ^^



来源:https://stackoverflow.com/questions/3533001/should-i-use-ruby-1-9-2-with-my-new-web-app

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