Me
About
Gallery
Company
Girl


Projects
Ruby on Rails
Basecamp
Highrise
Backpack
Campfire
Ta-da List
Writeboard


More
Feed
Archives

October 08, 15:10

How associations work in Active Record



Curtesy of Scott Baron


Challenge by Morten on October 08, 15:42

If I want an attribute on my M-M relation (eg. a user in a religiouscult can be "Leader", "Trainee", "MCP".. or whatever you have stored in your "roles" table), what would be the proper Rails way of doing this?

I still haven't found the time to take Rails for a whirl [1], so if there's a FAQ entry on this, I wouldn't know..

[1]: Oxymoron you say? :-)

Challenge by mikkel on October 08, 15:43

What tool do you use to draw those diagrams???

thanks

Challenge by David Heinemeier Hansson on October 08, 15:57

Morten: Active Record supports Single Table Inheritance . So your Leader, Trainee, and so on with just subclass User and it would more or less "just work".

Mikkel: They were drawn using OmniGraffle.

Challenge by Scott Barron on October 08, 16:23

Mikkel:

I used omnigraffle to draw them. It's a pretty nice package for OSX.

-Scott

Challenge by Mikkel on October 08, 16:48

thanks....

ill check it out...

Challenge by Daniel Von Fange on October 08, 22:45

David, I think Morten is talking about an attribute on the relationship. For example someone could be a "Leader" in one cult, and a "Security Guard" in another.

I'm also interested in the recommended way of handling this in AR.

Challenge by David Heinemeier Hansson on October 08, 22:49

Ahh, no. In that situation, you'd introduce a new object called Role. That would say Role belongs_to :user and Role belongs_to :cult. In the parlor of Domain-driven Design, you've now deepened the model and you're likely to find that both additional behavior and data fits well on the Role class.

Challenge by Daniel Von Fange on October 08, 23:41

Gotcha.

In past, I used a Role class (with belongs_to relationships) and also used it's table for has_and_belongs_to_many relationships between users and cults.

Challenge by silverton casino on May 08, 20:09

Please check out some relevant pages in the field of custom poker chips custom poker chips http://www.juris-net.com/custom-poker-chips.html new york new york hotel and casino new york new york hotel and casino http://www.juris-net.com/new-york-new-york-hotel-and-casino.html slot machine game slot machine game http://www.juris-net.com/slot-machine-game.html gambling chips gambling chips http://www.juris-net.com/gambling-chips.html poker t shirt poker t shirt http://www.juris-net.com/poker-t-shirt.html play poker for free play poker for free http://www.juris-net.com/play-poker-for-free.html blackjack table plans blackjack table plans http://www.juris-net.com/blackjack-table-plans.html poker etiquette poker etiquette http://www.juris-net.com/poker-etiquette.html play blackjack online free play blackjack online free http://www.juris-net.com/play-blackjack-online-free.html las vegas slot tournaments las vegas slot tournaments http://www.juris-net.com/las-vegas-slot-tournaments.html free celebrity strip blackjack online free celebrity strip blackjack online http://www.juris-net.com/free-celebrity-strip-blackjack-online.html coin slot coin slot http://www.juris-net.com/coin-slot.html aristocrat slot machines aristocrat slot machines http://www.juris-net.com/aristocrat-slot-machines.html purchase slot machines purchase slot machines http://www.juris-net.com/purchase-slot-machines.html gambling casinos in tunica mississippi gambling casinos in tunica mississippi http://www.juris-net.com/gambling-casinos-in-tunica-mississippi.html games blackjack adult free games blackjack adult free http://www.juris-net.com/games-blackjack-adult-free.html northwood roulette northwood roulette http://www.juris-net.com/northwood-roulette.html online gambling best online gambling best http://www.juris-net.com/online-gambling-best.html legal gambling age in las vegas legal gambling age in las vegas http://www.juris-net.com/legal-gambling-age-in-las-vegas.html free roulette system perfect free roulette system perfect http://www.juris-net.com/free-roulette-system-perfect.html paragon roulette paragon roulette http://www.juris-net.com/paragon-roulette.html play online strip blackjack free play online strip blackjack free http://www.juris-net.com/play-online-strip-blackjack-free.html tips on playing roulette tips on playing roulette http://www.juris-net.com/tips-on-playing-roulette.html caveman keno online caveman keno online http://www.juris-net.com/caveman-keno-online.html craps cant lose strategy craps cant lose strategy http://www.juris-net.com/craps-cant-lose-strategy.html wildball keno wildball keno http://www.juris-net.com/wildball-keno.html blackjack 21 blackjack 21 http://www.juris-net.com/blackjack-21.html deluxe 52 blackjack table deluxe 52 blackjack table http://www.juris-net.com/deluxe-52-blackjack-table.html how to cheat at black jack how to cheat at black jack http://www.juris-net.com/how-to-cheat-at-black-jack.html aktuelle vortagespermanenz roulette aktuelle vortagespermanenz roulette http://www.juris-net.com/aktuelle-vortagespermanenz-roulette.html gen john black jack pershing gen john black jack pershing http://www.juris-net.com/gen-john-black-jack-pershing.html roulette wheel clocking roulette wheel clocking http://www.juris-net.com/roulette-wheel-clocking.html black jack poker rules black jack poker rules http://www.juris-net.com/black-jack-poker-rules.html free roulette stratergy free roulette stratergy http://www.juris-net.com/free-roulette-stratergy.html mass keno number results mass keno number results http://www.juris-net.com/mass-keno-number-results.html ...

Challenge by abay on June 04, 12:07

Hello. I am new here. It is very interesting.
mature gallerys older women and younger men mature nudists photos mature nud3 pics mature nudists photos mature spunker mature anal older women and younger men older s3xy women classic mature older women and younger men mature gallerys mature video free thumbnail pictures of older women mature gallerys mature amature mature nud3 pics mature women stories mature nud3 pics older moms mature gallerys mature anal older women and younger men mature nud3 pics lyrics to older country songs older s3xy women mature amature mature gallerys nud3 senior women classic mature older women and younger men mature ladies in lingerie mature living mature video mature nud3 pics older women and younger men mature anal mature ladies in lingerie mature spunker mature gallerys

Challenge by tanita on June 05, 5:36

Sorry for my links
pantyhose crossed legs pantyhose crossed legs pantyhose and nylon feet and toes girls in body stockings girls in fishnet stockings free pantyhose thumbs pictures of crossed nylon legs pantyhose and nylon feet and toes pantyhose mpeg pantyhose mpeg men who wear pantyhose girls in fishnet stockings girls in fishnet stockings free pantyhose thumbs men who wear pantyhose men who wear pantyhose boys in pantyhose free panty thumbnail gallery pantyhose chat pantyhose mpeg free panty thumbnail gallery men pantyhose men pantyhose pictures of crossed nylon legs free panty thumbnail gallery pictures of crossed nylon legs mature pantyhose pictures russian pantyhose women nylon galleries girls in fishnet stockings men who wear pantyhose pantyhose and nylon feet and toes nylon stocking galleries nylon stocking galleries free pantyhose thumbs free pantyhose thumbs cum on panties pantyhose mpeg pantyhose and nylon feet and toes boys in pantyhose

Challenge by ivan on June 05, 9:21

Hello. I am new here. It is very interesting.
latina creampie pictures creampie creampies free creampies free creampie anal creampie pussies creampie movie pictures creampie creampie movie latina creampie pictures creampie free creampie pics and stories asian creampies latina creampie free creampie clips gangbang creampies videos free creampie clips creampie internal, cumshots creampies xyx creampies free free creampie s3x creampie pussies interracial wives bareback creampies gangbang creampies videos free creampie pics free interracial wives bareback creampies interracial wives bareback creampies free creampie pics and stories latina creampie gangbang creampies videos creampie movie pictures creampie creampie internal, cumshots free creampie clips creampies xyx free creampie pics free creampie internal, cumshots creampie internal, cumshots latina creampie free creampie clips

Challenge by tanita on June 05, 17:31

Sorry for my links
mature women in stockings free mature s3x mature babes mature men galleries free mature s3x older men younger women dating mature women older thumbs older thumbs mature over 50 mature over 50 older thumbs mature women nud3 older thumbs mature asian old naked women mature women nud3 mature 1esbians free older women free mature dating mature women mature women t9p mature wives old naked women mature women t9p mature women t9p older women younger men mature 1esbians mature women nud3 mature men galleries mature 1esbians older men younger women mature asian mature amateur mature wives dating mature women older thumbs free mature p0Rn free older women mature 1esbians

Challenge by den on June 06, 11:51

Hello. I am new here. It is very interesting.
mature pantyhose pictures mature asian women naked old women thumbs naked old women thumbs mature asian women older holland thumbs gallery older women mature index free older women galleries mature mistress mature hardcore links mature hardcore links young girls older men free older women galleries young girls older men mature women over 40 mature pantyhose pictures mature mistress naked old women thumbs thumbs gallery older women older holland older 1esbians young girls older men mature asian women young girls older men mature pic gallery mature pic gallery older women stories mature glamour older 1esbians mature big tits mature mistress mature women over 40 mature hardcore links mature women over 40 naked old women thumbs mature index older holland older women stories black older ladies

Challenge by mara on June 06, 19:26

Hello. I am new here. It is very interesting.
free 1ncest storys s3x 1ncest mom son family s3x stories 1ncest free gallery free 1ncest storys real 1ncest mom son galleries 1ncestgrrl's free 1ncest stories free 1ncest storys teens 1ncest pics family s3x stories mom son s3x 1ncest russian 1ncest stories of 1ncest brother sister s3x free 1ncest photos 1ncest chat family 1ncest pictures father son 1ncest mom 1ncest free 1ncest photos 1ncest chat 1ncestgrrl's free 1ncest stories free 1ncest storys free 1ncest photos 1ncest chat brother sister s3x brother sister s3x stories of 1ncest russian 1ncest 1ncest bbs family s3x stories 1ncest bbs family 1ncest pictures free 1ncest photos real 1ncest s3x 1ncest stories of 1ncest

Challenge by bob on June 08, 0:32

Hello. I am new here. It is very interesting.
pantyhose images office girls in nylons panty fetish mature pantyhose pics men caught wearing pantyhose panty fetish mature pantyhose pics white pantyhose hooters girls in pantyhose men caught wearing pantyhose men caught wearing pantyhose mature pantyhose pics satin panty galleries men caught wearing pantyhose girls in nylons office girls in nylons office girls in nylons free wet panty panty post satin panty galleries free wet panty panty thumbnails pantyhose images satin panty galleries celebrities in pantyhose panty thumbnails men caught wearing pantyhose girls in nylons cheerleader panty pics cheerleader panty pics mature ladies in pantyhose free wet panty free teen panties mature ladies in pantyhose office girls in nylons panty fetish satin panty galleries wet pantyhose satin panty galleries white pantyhose

Challenge by den on June 08, 4:25

Hello. I am new here. It is very interesting.
panty girls bra and panty pics pantyhose men free pantyhose sites pantyhose foot gallery men in panty pics pantyhose foot gallery mature women in nylons teens in pantyhose free pantyhose pics pantyhose pic gallery free pantyhose sites teen panty pictures free panty galleries free panty galleries pantyhose fetish pantyhose pic gallery pantyhose pic gallery silkies pantyhose teens in pantyhose pantyhose pic gallery panty girls free panty galleries free pantyhose pics free panties mature women in nylons crotchless pantyhose mature women in nylons panty line pics little school girls panties crotchless pantyhose little school girls panties pantyhose fetish crotchless pantyhose free pantyhose sites pantyhose foot gallery wolford pantyhose free panty galleries little school girls panties men in panty pics

Challenge by mikle on June 08, 19:25

Hello. I am new here. It is very interesting.
older women pictures mature 1esbian daily mature boobs mature personals mature s3x pics mature 1esbian free mature s3x pics mature 1esbian older pussy mature s3x pics nud3 mature bcn mature nud3 mature men victor mature mature content nud3 mature black women mature 1esbian mature 1esbian victor mature older women pictures meet older women nud3 mature nud3 mature black women s3xy mature women nud3 mature men mature s3x pics nud3 mature black women nud3 mature men older pussy mature older t9p mature 1esbian nud3 mature top mature t9p's older women pictures s3xy mature women victor mature free mature s3x pics free mature s3x pics bcn mature nud3 mature men

Challenge by free poker on June 21, 9:58

You may find it interesting to take a look at the pages about free poker free poker http://www.poker-adventure.com/free-poker.html ...

Challenge by internet casino on June 22, 9:07

In your free time, take a look at some relevant information in the field of internet casino internet casino http://www.scottishtutors.com/internet-casino.html .

Challenge by world series of poker on June 24, 16:38

You are invited to take a look at some relevant information on world series of poker world series of poker http://www.uclaaud.org/world-series-of-poker.html poker table poker table http://www.uclaaud.org/poker-table.html world poker tour world poker tour http://www.uclaaud.org/world-poker-tour.html free poker games free poker games http://www.uclaaud.org/free-poker-games.html how to play poker how to play poker http://www.uclaaud.org/how-to-play-poker.html poker hand rankings poker hand rankings http://www.uclaaud.org/poker-hand-rankings.html celebrity poker celebrity poker http://www.uclaaud.org/celebrity-poker-.html - Tons of interesdting stuff!!!