Should I Learn RoR

Reason number one: because it will make you a better ASP.Net programmer. Or more generally, it will make you a better programmer and makes you more marketable.

Learning something like Ruby and Rails provides you with a different perspective on how to solve problems and how to program. This knowledge is not limited to being used just with Rails, it can be applied to problems being solved in ASP.Net.

One good video that I would recommend is Chad Fowler’s, Don’t Follow the Lemmings[1].

In terms of books, check out either THE book - Agile Web Development with Rails, or Burce Tate’s Ruby on Rails Up and Running. The later book is shorter, but still gives a good overall view of Rails.



yes, if you use a plugin such as DRYSQL. If you don't you'll need to
specify has_many and co relation stuff in your models.

Patrick Aljord wrote:

MereMortal wrote:
> another question:
> is it also the case that in Ruby, you just design the relational tables
> in an RDBMS (say like MySQL0 and Ruby turns them automatically into an
> object hierarchy? is that all you have to do?
yes, if you use a plugin such as DRYSQL. If you don't you'll need to
specify has_many and co relation stuff in your models.

You answered the high-level question.

The low-level question is this. If you have a database with a table in
it call People, and its primary key is called 'id', and you have a
config/database.yml file pointing to it, then this is all the Ruby you
must write to access a record in the table

class Person < ActiveRecord::Base

That gives you several million convenience functions to access any
Person by any attribute, and upgrade & write that Person back.

p = Person.find(42) = "Forsythe"!

The system reads the People schema and builds all the elements of the
Person object automatically. Oh, and it also changes the number of the
nouns, where appropriate.

Next, you might want to "refactor" your database. That's typically
hard, because customer data must survive upgrades. Rails provides a
complete "migration" system to let you express database changes as
high-level commands, such as rename_column or add_column.

Next, if you have relations in your database, you can match them with
Rails relations:

class Person < ActiveRecord::Base
   has_many :pets

That pulls in another table, Pets, and matches the person_id in each
pet with the id of each Person. That provides lines like...

dogs = person.pets.find_by_species('dog')

Patrick answered the question "why doesn't the schema reader also read
the relations and automatically set all the has_many and such
directives correctly". Default Rails doesn't do that because you
typically want a minor subset of all the relations.