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 trialAimee Knight
9,701 PointsEnvironment for Playing with Rails 4
I used Railsinstaller on my OS X 10.7.5 in March and it appears my environment is currently:
rvm 1.21.9
ruby 1.9.3p392
Rails 3.2.13
When I run: gem list
*** LOCAL GEMS ***
actionmailer (3.2.13, 3.2.12) actionpack (3.2.13, 3.2.12) activemodel (3.2.13, 3.2.12) activerecord (3.2.13, 3.2.12) activeresource (3.2.13, 3.2.12) activesupport (3.2.13, 3.2.12) annotate (2.5.0) appscrolls (0.9.0) arel (3.0.2) bcrypt-ruby (3.0.1) bigdecimal (1.1.0) bootstrap-sass (2.1.0.0) bootstrap-will_paginate (0.0.6) builder (3.0.4) bundler (1.2.4) capybara (1.1.2) carrierwave (0.8.0) childprocess (0.3.9) coffee-rails (3.2.2) coffee-script (2.2.0) coffee-script-source (1.6.3, 1.6.2, 1.4.0) cucumber (1.3.1) cucumber-rails (1.2.1) database_cleaner (0.7.0) devise (2.2.3) diff-lcs (1.1.3) erubis (2.7.0) execjs (1.4.0) factory_girl (4.1.0) factory_girl_rails (4.1.0) faker (1.0.1) ffi (1.8.1) figaro (0.7.0) gherkin (2.12.0) hike (1.2.3, 1.2.2, 1.2.1) i18n (0.6.4, 0.6.1) io-console (0.3) journey (1.0.4) jquery-rails (3.0.4, 2.2.1, 2.0.2) json (1.8.0, 1.7.7, 1.5.5) mail (2.5.4, 2.5.3, 2.4.4) mime-types (1.23, 1.22, 1.21) minitest (2.5.1) multi_json (1.7.7, 1.7.3, 1.7.2, 1.6.1) nokogiri (1.5.9) orm_adapter (0.4.0) pg (0.14.1, 0.12.2) polyglot (0.3.3) rack (1.4.5) rack-cache (1.2) rack-ssl (1.3.3) rack-test (0.6.2) rails (3.2.13, 3.2.12) railties (3.2.13, 3.2.12) rake (10.1.0, 10.0.4, 10.0.3, 0.9.2.2) rdoc (3.12.2, 3.12.1, 3.9.5) rspec (2.11.0) rspec-core (2.11.1) rspec-expectations (2.11.3) rspec-mocks (2.11.3) rspec-rails (2.11.0) rubygems-bundler (1.1.0) rubyzip (0.9.9) rvm (1.11.3.6) sass (3.2.9, 3.2.8, 3.2.7, 3.2.6) sass-rails (3.2.6, 3.2.5) selenium-webdriver (2.32.1) simple_form (2.1.0) sprockets (2.2.2) sqlite3 (1.3.7, 1.3.5) thor (0.18.1, 0.17.0) tilt (1.4.1, 1.4.0, 1.3.7, 1.3.6, 1.3.3) treetop (1.4.14, 1.4.12) tzinfo (0.3.37, 0.3.35) uglifier (2.1.2, 2.1.1, 2.1.0, 2.0.1, 1.3.0, 1.2.3) warden (1.2.1) websocket (1.0.7) will_paginate (3.0.3) xpath (0.1.4)
I took a look at http://railsapps.github.io/updating-rails.html & http://railsapps.github.io/installing-rails.html and see that RailsInstaller is probably not the best option (although I'm certainly not a prof Rails Dev).
Since I'm still very new, but would like to experiment with Rails 3.2 and 4, what's my best option? Given that I initially set up my environment with RailsInstaller, should/can I just generate a new app, update the Gemfile and run bundle update rails right away? To me that seems messy, but in my newness, I'm not really sure what the best approach is?
Finally, I'm also unsure if I need to update Ruby? I tried running rvm get stable earlier today, but received a few error message. However, from the Gemfile list above, it appears to have updated? Do you think I'm safe to run rvm install ruby?
Please let me know if I can clarify any information, or provide an further log info. I sincerely appreciate the time anyone is able to take in helping me ensure I'm setting up my environment properly.
4 Answers
Jason Seifer
Treehouse Guest TeacherHey all! We just updated some content and there's now a whole section on Installing a Ruby Development Environment. If you have any trouble, I recommend checking out the Treehouse VM for the most consistent way of installation.
Kevin Lozandier
Courses Plus Student 53,747 PointsYou can have both installed; it's just that you would have to make effective use of bundle exec or install the binstubs for the Rails 3.2 app to make it easier for you to manage the Rails 3.2 app along with your Rails 4 installation.
I've used Rails 3.2 and Rails 4 on windows with no issues for over 5 months.
Being a person familiar with Railsapps, you honestly shouldn't have to install a Rails 3.2 now; I would recommend knowing how to use Rails 4 and adjust following the tutorials of RailsApp with Rails 4 conventions such as mass-assignment concerns now done int he controller via strong-parameters and so on.
All gems used by RailsApp with the exception of maybe Mongoid are Rails 4 compatible. U
Unless your job requires it, I would merely understand the gist of the old Rails 3.2 conventions.
Or, if you can wait, wait till railsapp upgrade all their apps to Rails 4; he's in the process of doing so.
Regarding Rails Installer
Unless they upgraded their installer to Rails 4, I would avoid the RailsIntaller. Since you seem already aware of rvm, merely install Ruby 2.0, install Rails, and begin your Rails adventure already.
Aimee Knight
9,701 PointsKevin or Jason Seifer ,
Thanks for the response. I guess (please tell me otherwise) what I want to do, is update to Ruby 2 and Rails 4. If I follow the railsapps instructions (which are a bit over my head) and run
rvm get stable --autolibs=enable
I get the following output:
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 13779 100 13779 0 0 7922 0 0:00:01 0:00:01 --:--:-- 7922
Downloading RVM from wayneeseguin branch stable
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 1408k 100 1408k 0 0 683k 0 0:00:02 0:00:02 --:--:-- 1389k
Upgrading the RVM installation in /usr/local/rvm/
Can not automatically remove lines with 'rvm_autolibs_flag=' from '/etc/rvmrc', please clean it manually.
Found 40929 files not belonging to 'rvm', use `--debug` to see the list, prefix the command with 'rvmsudo' to fix it, if the situation persist report a bug.
Found 2762 directories with mode different then '775', use `--debug` to see the list, prefix the command with 'rvmsudo' to fix it, if the situation persist report a bug.
Found 12859 files with mode different then '664' or '775', use `--debug` to see the list, prefix the command with 'rvmsudo' to fix it, if the situation persist report a bug.
Upgrade of RVM in /usr/local/rvm/ is complete.
# Aimee Knight,
#
# Thank you for using RVM!
# I sincerely hope that RVM helps to make your life easier and more enjoyable!!!
#
# ~Wayne
# In case of problems:
# run and read: rvm notes
# read docs: http://rvm.io/
# talk to us: http://webchat.freenode.net/?channels=rvm
# read cheatsheet: http://cheat.errtheblog.com/s/rvm
# watch screencast: http://screencasts.org/episodes/how-to-use-rvm
# open a bug report: https://github.com/wayneeseguin/rvm/issues
Upgrade Notes:
* WARNING: In case of using Zsh, version 4.3.12 / 5.0.0+ is recommended, you have 4.3.11, errors to be expected.
* WARNING: you have 'rvm_configure_env' in /etc/rvmrc, run the following to fix:
sudo sed -i'' -e "/rvm_configure_env=.*\/opt\/sm/d" /etc/rvmrc
rvm autolibs smf
* No new notes to display.
RVM reloaded!
Can you, or anyone else please tell me if I'm ok to run
rvm install 2.0.0
Then, what are my next steps for installing Rails? I'm sorry, but I am pretty new and want to make sure I understand and am doing this correctly.
Jason Seifer
Treehouse Guest TeacherRVM should have been installed with RailsInstaller. You should be ok to install 2.0 through rvm. Afterwards you can do "gem install rails" and you will get 4.0.
As a heads-up, we're not supporting Rails 4 in the videos just yet and there will be a ton of differences as you follow along. This could get difficult as you go through.
Aimee Knight
9,701 PointsI REALLY appreciate you taking a minute to look. What I would like to do is learn Rails 4 via Hartl's tutorial, and also continue on with Treekbook using 3.2. Essentially, can I set up my computer as mentioned above so that whenever I run "rails new ..." it will always default to Rails 4, but continue to create Rails 3.2 apps by just changing the specification in the Gemfile immediately after I generate the app?
Can I
- Install Ruby 2.0 system wide with RVM and set that as my default?
- Run "gem install rails" (I assume this will be system wide now so that when I do "rails new ...", I'll always have a new Rails 4 app)?
- Keep Rails 3.2 in my Treebook gemfile and continue working as is?
- Start the Hartl 4 tutorial which will generate a Rails 4 app since this is now the latest version on my system?
I appreciate your patience because I'm sure it takes a lot dealing with our ignorance so often!
Aimee Knight
9,701 PointsEdit: With help from Kevin at Rails Machine, I'm all set now. I'll post the solution when I add it to my blog for other newbies!
For some reason I'm not able to edit my full message above so here is what I'd like to add.
Can I alternatively keep Rails 3.2 as my system default and only use Rails 4 by following the commands below?
$ mkdir myapp
$ cd myapp
$ rvm use ruby-2.0.0@myapp --ruby-version --create
$ gem install rails
$ rails new .
jadaml
11,593 PointsJason Seifer What combo of Ruby and Rails should we run then? How do we initiate that? A little more information here would be helpful if the tutorials wont work with current versions.
Aimee Knight
9,701 PointsJadam L Sorry... looks like Treehouse deleted my comment when I tried to update it. Here's a link to what I ended up doing. http://aimeemarieknight.com/blog/
You're just going to do something like
gem install rails --version=3.2.13
once you create your .rvmc file instead of
gem install rails
You should be fine using whatever version of Ruby you have (if you installed recently). Feel free to let me know if you have questions and I will try to help.
jadaml
11,593 PointsThanks Aimee!
jadaml
11,593 PointsWhen I tried to create the custom gem set:
From there, you’ll create a directory specific gemset. I’ve explicitly stated I want to use Ruby 2.0.0, but of course you can choose whichever version you like. rvm –rvmc –create 2.0.0@rails_4
I get the following error:
Unrecognized command line argument(s): '–rvmc 2.0.0@rails_4' ( see: 'rvm usage' )
Aimee Knight
9,701 PointsJadam L , those are double dashes
rvm --rvmrc --create 2.0.0@rails_4
Sorry for the confusion. I'm going to update my post also since it's hard to see.
Stephen Whitfield
16,771 Pointsyou probably have it installed, you just aren't using the login shell.
/bin/bash --login rvm use 2.0.0 #~> Using /../rvm/gems/ruby-2.0.0-p353
then check to see that rails 4.0+ is being used with that ruby version rails -v #~>Rails 4.0.2