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

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.