Learning Active Record is tough for a newb

But please correct me if i’m wrong:
to better conceptualize all the different relationships, think of them
as this:
has_many_in :your_association
has_one_in :your association

otherwise, just trying to read ’ has_many’ is kinda vague. It could mean
‘has_many_of’, and if you think of it like that, your association would
then turn into a ‘has_one’ instead of many…

just imagining an ‘in’ at the end of your relationships makes it so much
clearer.

Insights?

Dominic S. <[email protected]…> writes:

then turn into a ‘has_one’ instead of many…

just imagining an ‘in’ at the end of your relationships makes it so much
clearer.

Insights?

class Millionaire < ActiveRecord::Base
has_many :houses
# has_many_in :houses # doesn’t seem right
end

class House < ActiveRecord::Base
belongs_to :millionaire
end

Gareth

But please correct me if i’m wrong:
to better conceptualize all the different relationships, think of them
as this:
has_many_in :your_association
has_one_in :your association
I may be wrong but I think you’re thinking of the tables rather than the
objects the tables represent.

Think of how you would describe the relationship between (using Gareth’s
example), a Millionaire and his Houses:

A millionaire has many houses
A house belongs to a millionaire

Does that make sense?

Steve

read up on Entity Relationships and learn to draw an E-R Diagram with
cardinality this will help you with the concept

On 8/31/06, Stephen B. [email protected] wrote:

Think of how you would describe the relationship between (using Gareth’s

www.blogsaic.com
search, post, blog

Lots of help here guys.

I’ve been blasted in the Rails IRC room that i am wrong…

I swear i was on to something! maybe not…

Dion H. wrote:

read up on Entity Relationships and learn to draw an E-R Diagram with
cardinality this will help you with the concept

On 8/31/06, Stephen B. [email protected] wrote:

Think of how you would describe the relationship between (using Gareth’s

www.blogsaic.com
search, post, blog