[OT] ROR Difference between has one and belongs to one

Bob Sneidar bobs at twft.com
Thu Apr 26 11:38:27 EDT 2012


Thanks Mark! That helps a lot! I will forward this to the web guy. 

Bob


On Apr 25, 2012, at 7:19 PM, Mark Wieder wrote:

> Bob-
> 
> Tuesday, April 24, 2012, 9:31:05 AM, you wrote:
> 
>> Hi. For anyone who has experience using Ruby on Rails, I have a
>> friend who is redesigning the corporate web site, and he wants to
>> use ROR. He is stumped at their way of defining relationships. He
>> says there is a Belongs To One relationship and a Has One
>> relationship. It sounds to me like they are talking about a one to
>> one relationship from different directions but why that would be
>> useful I do not know. Anyone have any wisdom on the subject?
> 
> Typically in object-oriented design you're presented with the choice
> between subclassing an existing object (making a new object with all
> the properties of the original, but with a few additions or
> differences) or creating an aggregate object which contains two or
> more other objects. The textbook answer to when you do one and when
> you do the other comes down to:
> 
> if you have a "has a" relationship then you make a complex object
> if you have a "is a" relationship then you subclass an existing one
> 
> For instance, if you want to create a button with a blue background,
> you'd use a button object and change its properties. That would be an
> "is a" relationship. You wouldn't make a group with a button and a
> blue graphic overlay object to do the trick.
> 
> Rails also has the concept of "convention over configuration", which
> is basically "we've already figured out the best way to do things, so
> don't get creative here." The idea being that if you have to go and
> configure things they'll break, so just use the frameworks the way
> they're written, and design your application around rails rather than
> trying to integrate rails into your application.
> 
> -- 
> -Mark Wieder
> mwieder at ahsoftware.net
> 
> 
> _______________________________________________
> use-livecode mailing list
> use-livecode at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode





More information about the use-livecode mailing list