Forum: Ruby on Rails how to use has_many and belongs_to ?

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
BoBKilla (Guest)
on 2008-11-18 16:02
(Received via mailing list)
Hello there,
im kind of a newbie with ruby on rails and i have a question about
has_many and belongs_to because i saw tutorials where they use it but
i don't see how it works ? What if you don't use it ?
In fact i don't see if it is actually usefull...

Please give me some light =)
Ar C. (Guest)
on 2008-11-18 16:05
has_many / belongs_to is how you tell Rails that models are related...

Start reading here:

http://api.rubyonrails.org/

Look at the ActiveRecord::Base entry to begin your instruction
Grasshopper...
Frederick C. (Guest)
on 2008-11-18 16:06
(Received via mailing list)
On 18 Nov 2008, at 12:51, BoBKilla wrote:

>
> Hello there,
> im kind of a newbie with ruby on rails and i have a question about
> has_many and belongs_to because i saw tutorials where they use it but
> i don't see how it works ? What if you don't use it ?
> In fact i don't see if it is actually usefull...
>
Well associations are pretty fundamental to Active Record. You don't
have to use them but you'd just be creating a lot of work for yourself
and missing out on a lot of the handy bits in rails.
http://guides.rails.info/association_basics.html is probably not a bad
place to start.

Fred
BoBKilla (Guest)
on 2008-11-19 11:24
(Received via mailing list)
thanks, now i see why it is usefull to use it !
This topic is locked and can not be replied to.