associations in console

9 views
Skip to first unread message

fugee ohu

unread,
Dec 29, 2015, 10:15:47 PM12/29/15
to Ruby on Rails: Talk
if users has one profile and profiles has many schools should i be able to see schools at u.profiles.schools where u is a user object

Colin Law

unread,
Dec 30, 2015, 2:26:03 AM12/30/15
to Ruby on Rails: Talk


On 30 Dec 2015 03:16, "fugee ohu" <fuge...@gmail.com> wrote:
>
> if users has one profile and profiles has many schools should i be able to see schools at u.profiles.schools where u is a user object

No u.profiles is effectively an array. Have a look at has many through.

Colin

>
> --
> You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-ta...@googlegroups.com.
> To post to this group, send email to rubyonra...@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/75bfbbf7-dc86-41ed-9658-50cc7a6138f7%40googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages