Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialScott Reuber
Courses Plus Student 12,756 PointsDifferent Rails versions
I know the confusion over different Rails versions has been discussed elsewhere on the forums, but I'm just asking for clarification when it comes to addressing these issues when I revisit some of these lessons that are based off of different versions...
So, if I'm working on a Rails lesson that's using an older version, I can install that version separately, right? I was able to successfully install Ruby and Ruby on Rails from the 'Installing a Ruby Development Environment' lesson on my Macbook Pro (running Mavericks). So based off that lesson, I typed:
gem install rails --version=4.0.2
For an older version, then would I simply enter (for example):
gem install rails --version=3.2.14
or something? How would I then tell it which version it should be using? Also, would the Ruby version matter, and if so, can that be switched?
I had much better luck with the rbenv method than RVM in the past.
Please note that I'm speaking from "totally a designer not a developer so please don't be afraid to dumb it down" and if something I just explained makes no sense bear with me.
2 Answers
Maciej Czuchnowski
36,441 PointsAs far as I know:
Since Rails is simply a gem, you can have multiple versions on your computer and they just sit there, but when you are working with a particular application, it's the Gemfile that decides which version is used. If you simply run "rails new AppName", this will most likely generate a new app using the newest version of Rails gem that you have installed (this will also influence the folder structure of the application, since there are differences between versions 3 and 4 in that field). You would have to explicitly declare the desired version of Rails when generating a fres application if you want it to use an older version of Rails gem. Like this:
rails _3.2.14_ new AppName
And after you run bundle install in that app's folder, it will fetch and use the selected Rails version.
You can also have multiple versions of Ruby installed, but their management is more complex and tricky and I myself don't fully understand it yet, I simply use 1.9 in all my apps right now. Ruby versions can introduce some issues, but the differences are not as big compared to differences in Rails versions. And you can switch Ruby version mid-project when you are sure that it causes conflicts, while I'm not sure you can downgrade the Rails gem version once the app is generated and bundle is run using the newer version.
Scott Reuber
Courses Plus Student 12,756 PointsGood to know.
I think it would be a solid idea if Jason or whoever appends the older lessons with some warning or message about which version of Rails they need to be using. Not sure if all the lessons explicitly stat ethat.
Maciej Czuchnowski
36,441 PointsYeah, they should add a separate introductory video for the whole Treebook app - it's still a great course and teaches a lot and knowing Rails 3 is still a good idea, they just need to mention that issues can appear here and there and why and how to deal with them before we generate our first Treebook app.