Code in friendship or user controller?

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

On 17 December 2011 16:22, Jay D. [email protected] wrote:

@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

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs