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 not working the same way (OSX 10.8.4)

I've been trying to learn Ruby but it doesn't work the same way as the deep divine within my terminal. For instance, when I use the String.New("insert txt here") I don't get a text response within the terminal. I've installed TextMate as well, and the editor being launched with a new document or even opening a saved document within my terminal doesn't work, it won't launch and gives me tons of error messages.

2 Answers

Hi Dmitri,

In the book Ruby on Rails Tutorial, Michael Hartl gives some really excellent advice that, I've found to be quite useful since reading, "the โ€œGoogle the error messageโ€ algorithm nearly always produces a relevant blog post or discussion-forum thread." http://ruby.railstutorial.org/ruby-on-rails-tutorial-book

If you could copy/paste the error messages you're getting, it might help us determine a possible solution to your problem.

As for launching TextMate from your terminal, you may need to set the path to use 'mate' as a terminal command. Here are a couple of links that might get you started with that: http://superuser.com/questions/201251/how-to-add-textmate-to-my-path-on-mac http://manual.macromates.com/en/using_textmate_from_terminal.html

I hope that helps. Also, looking forward to seeing your replies regarding the actual error messages you're getting or a solution if you have already found one.

Cheers,

Drew

Stone Preston
Stone Preston
42,016 Points

I havent used textmate, but with sublime you have to make symlink which is described here. After you do that, you can use the subl command to open files etc in sublime from the terminal. I would recommend trying sublime, especially since it is what is used in the videos.

As far as the ruby stuff is concered, typing the commands in terminal wont work, you have to type them in terminal within IRB (interactive ruby). to enter Irb, just type irb at the command line and it should show something like 1.9.3p392 :001 > with a cursor out beside that. There you can enter in the ruby code such as

 my_string = String.New("insert txt here")

Stone,

Great link for sublime, and thanks for the info on IRB!

Just a note,

my_string = String.New("insert txt here")

gives me the following error: NoMethodError: undefined method `New' for String:Class

Whereas this works for me

my_string = String("insert txt here")

Cheers,

Drew