Domanda

I am going through Ruby on Rails Tutorial by Michael Hartl. Situation: I am creating a microblogging website (a minimalist twitter clone) using Rails 3.1.3 and Ruby 1.9.3. I have created the sign-up, sign in, and sign out functionality so far, which is Chapter 8 in Michael Hartl's tutorial.

Question: Since I am in middle of this project, can I switch to Rails 4 and Ruby 2 at this point without creating compatibility issues? I assume Rails 4 and Ruby 2 to be back-compatible but I am not sure. If I can actually switch the latest versions of Rails and Ruby I know I have to update my Gemfile and download newer Ruby using RVM, I just don't want to do it without being certain it is going to work. A reply will be appreciated. Thanks.

È stato utile?

Soluzione

One can always migrate to newer version but there are few things that needs to be taken care of. Instead, you can think about installing multiple versions of Rails and switching between them as you step through the process of updating your Rails applications using rvm.

I would highly recommend reading Updating Rails article by Daniel Kehoe.

Also, see an excellent Railscasts video by Guru Ryan Bates.

Altri suggerimenti

I was in the same situation as you, having started awhile back before Rails 4 and Ruby 2. A lot of the code snippets he uses will be incompatible unless you are running Rails 4. Things like the before_filter in chapter 9 I believe are different between the two versions. He's usually pretty good at saying what has changed.

You can probably do what Kirti suggested and use RVM while stepping through the process of updating the rails app. I actually decided to just start the tutorial over (I was at chapter 9), and I'm glad I did because it reinforced a lot of the material. At Chapter 8, you're not too far in to make this a bad call. I can promise you it's a lot quicker the second time around.

Good luck learning Rails!

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top