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 trial

Ruby Ruby Foundations Ruby Basics IRB and Your First Ruby Program

Joshua Perry
Joshua Perry
2,962 Points

I'm confused - Ruby in Sublime Text 2?

I'm very frustrated with how these courses do not seamlessly connect from one to the next. I'm on the Ruby track and I just completed "Installing a Ruby Environment" It took me a while, but I got everything up and running as laid out in the Mac version.

I now have Ruby 2.2.0 installed and I also installed the Virtual box, Sublime text, etc. Now I'm watching this course - and it's clearly back-tracking on stuff we already did (Install Ruby), but it's describing it in very different ways. I'm completely lost and frustrated.

Anyway, here is my question. Should I be doing these IRB exercises in the terminal or in sublime text 2?

If someone could please guide me - I'm a total beginner and am having difficulty connecting the dots.

Thanks!

3 Answers

Maciej Czuchnowski
Maciej Czuchnowski
36,441 Points

Also: you do things in Sublime Text (or ANY other text editor, doesn't matter, Jason uses Sublime because he likes it) if they require a few lines of code. IRB is used mainly for executing a single line on the fly. You should also try Workspaces, doesn't require you to install anything: http://teamtreehouse.com/workspaces

Maciej Czuchnowski
Maciej Czuchnowski
36,441 Points

Ruby Foundations is an old course, the Ruby Track got refreshed, at least I see it starting with Ruby Basics Course and there is no mention of Rails Foundations in it: http://teamtreehouse.com/tracks/learn-ruby

Joshua Perry
Joshua Perry
2,962 Points

Sorry, I misspoke, I'm actually on the Rails Development track.

Maciej Czuchnowski
Maciej Czuchnowski
36,441 Points

OK, for Rails Track you should ignore Ruby installation stuff and Ruby Foundations ;). If you want to learn pure Ruby before Rails, go with the Ruby track I mentioned.

Joshua Perry
Joshua Perry
2,962 Points

Thanks Maciej. Would you recommend that I switch to the Ruby track, finish that, and then come back to the rails track and pick up at Build a Todo List?

My end goal is to learn to build applications in Rails.

Maciej Czuchnowski
Maciej Czuchnowski
36,441 Points

Well, Ruby is used in Rails, so if you know how to use Ruby, Rails will come a bit easier. So I would recommend learning Ruby first. You can also try Rails to see which parts of Ruby are used most often and then go back to Ruby to practice them. Depends on your learning style.

Hey Joshua! I ran into this problem, too. I was extremely frustrated that we had just gone through a video series showing us exactly what to install and how to do it. Sublime Text 2 was recommended. Now, they're using an archaic version of TextMate.

I spent the better part of the day trying to figure this out and finally got it to work for me.

First, make sure your local bin directory exists. Type the following into your console:

mkdir /usr/local/bin

The, copy and paste the following into the terminal:

sudo ln -s "/Applications/Sublime Text 2.app/Contents/SharedSupport/bin/subl" /bin/subl

It looks very similar to the other stuff, but there is a minor difference or two. Try pasting that in, hit enter. Nothing will happen, but no error message will come up either. Then, type 'subl' + the name of a new file you want to create. For example: subl new_file.rb

Note, it has to have the .rb tag on the end, so that it's recognized and created as a ruby file.

Once you've done that (and hopefully Sublime Text opened with your new file name), type in some basic ruby, like:

puts "Hello World"

Save the project with command + S (on mac, or equivalent on Windows)

Go back to your terminal and type in: ruby new_file.rb (or whatever you named your file)

You use the ruby command + whatever your file name is, ended with.rb

That should have printed out the result of your ruby code (Hello World, in the above example).

Hope this helps - let me know if it worked for you. These kind of problems can be really frustrating and deRAIL (pun intended) your work flow.

Best of luck! Pete