Hi All,

I have an existing users/index view that displays all the users
registered by the app. I want to modify it such that it also
displays friends (existing and invited). However, the code used to
pull friendship data front the db is located in the friendships
controller. I can add:

@friends = current_user.friends
@pending_invited_by = current_user.pending_invited_by
@pending_invited = current_user.pending_invited

in the users controller to make it work but I wonder what the best
practices are for this sort of thing.

Thanks
JD

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

Search Discussions

  • Colin Law at Dec 17, 2011 at 8:05 pm

    On 17 December 2011 16:22, Jay Dizzle wrote:
    Hi All,

    I have an existing users/index view that displays all the users
    registered by the app.   I want to modify it such that it also
    displays friends (existing and invited).   However, the code used to
    pull friendship data front the db is located in the friendships
    controller.   I can add:

    @friends = current_user.friends
    @pending_invited_by = current_user.pending_invited_by
    @pending_invited = current_user.pending_invited
    In the users view just reference user.friends and the others directly.
    There is nothing wrong with that. friends is conceptually just a
    member of the User class.

    Colin

    --
    You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
    To post to this group, send email to rubyonrails-talk@googlegroups.com.
    To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
    For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
grouprubyonrails-talk @
categoriesrubyonrails
postedDec 17, '11 at 5:36p
activeDec 17, '11 at 8:05p
posts2
users2
websiterubyonrails.org
irc#RubyOnRails

2 users in discussion

Jay Dizzle: 1 post Colin Law: 1 post

People

Translate

site design / logo © 2022 Grokbase