Re: Is Radicore better than Ruby On Rails? [message #431 is a reply to message #44] |
Wed, 29 November 2006 18:19 |
darkmatter
Messages: 1 Registered: November 2006
|
Junior Member |
|
|
> 1. Table names must be plural
Not true. This is the default behavior, but you can override it (like almost *anything* in Rails):
class MyModel
set_table_name "my_model"
end
> 2. Primary keys must be auto_increment and named 'id'
Not true. Again, this is just the (overrideable) default:
class MyModel
set_primary_key "ModelId"
end
As for the "auto_increment" part, you are free to manage your
primary keys as you want, if you really want. There are even
plugins to handle composite primary keys.
> 3. Candidate keys must be ... ?
This is not very clear. What do you need candidate keys for when
you have a primary key? Maybe you should explain yourself better.
> 4. Relationships are inferred from foreign key names
Not true. Again, you seem to have a hard time distinguishing
the (very reasonable) Rails defaults from hard-coded conventions.
class MyModel
has_may :other_models, :foreign_key => "an_elephant"
end
> 5. Intersection tables in Many-to-Many relationships
"...RoR cannot recognise intersection tables unless they are named according to the rule alphabeticallyFirstTablePlural_alphabeticallySecondTablePlur al. "
Not true. Same old story.
class MyModel
has_and_belongs_to_many :elephants, :join_table => "pink_elephants_for_my_model"
end
> 6. Primary data validation
True, but nothing prevents you from writing a plugin that adds the necessary validation methods inferring them from the database schema. But the general philosophy behind Rails is that most of the business logic should be *visible* in the code. And anyway,
if you try e.g. to nullify a not-nullable column, you get a nice
exception from the database layer, which thankfully is very
easily handled in Ruby (unlike, say, in PHP4).
I would suggest that you try spending more than 1 minute on the Rails documentation and make some more amends to your document,
which at the moment relies almost entirely on wrong assumptions.
|
|
|