tags:

views:

154

answers:

6

I am primarily a fluent .NET developer (as can be seen from the amount of posts and threads I make about .NET), but I thought it would be good to learn RoR.

In doing so, I have a few questions about the architecture of the language (Ruby) and the framework (RoR):

1) In .NET, every object is derived from System but inherits System.Object. So when I type System., I get a list of namespaces and then in those namespaces, classes and more namespaces.

Does Ruby not have this sort of hierarchy?

2) In some cases, I don't get the intellisense. For example, I wrote the class as outlined here (http://wiki.rubyonrails.org/rails/pages/HowToSendEmailsWithActionMailer) but in the line recipients user.email, nothing comes up when I type "user.".

Any idea why?

Thank

+4  A: 

Dave Thomas (Pragmatic Programmers) has an excellent screencast series on the Ruby object model/metaprogramming. We watched this in a local Ruby user's group. The series isn't free, but it's not expensive either. You might want to check out the free preview to see if you think it is worth your time.

And to give you an answer. Yes, everything in Ruby derives from Object. You can find the docs on this at http://corelib.rubyonrails.org/. Look for the Object class.

I'm not sure why you aren't getting intellisense, partly because you haven't specified your IDE. It's possible that you can't because you've added the method dynamically and no intellisense is available.

tvanfosson
A: 
  1. If we compare .NET to Rails then yes, there is this kind of hierarchy there. And in general, you can achieve this kind of hierarchy in any Ruby application via using modules.
  2. I guess it's because of Ruby's dynamic nature.
Milan Novota
A: 

Ruby is a pure OO language meaning that everything from classes to objects derive from the Object class.

Keltia
A: 

Thanks for the answers guys.

I can't get round this intellisense issue. I'm using Komodo. If I had full intellisense support, it would be so much easier. :(

dotnetdev
a note: when making replies like this, you should add a comment to your question, not another answer
Claudiu
A: 

Download NetBeans. There is full intellisense support for Ruby and Ruby on Rails.

http://www.netbeans.org/features/ruby/index.html

mwilliams
A: 

Intellisense support probably won't get you what you think it will get you. Because Ruby is a dynamic language, Intellisense, or code completion, is difficult. What you will find is that either the drop down is so flooded with possible completions as to be useless. Or in your case nothing at all.

It's not 100% useless, but I have never found it terribly valuable.

Nathan Powell