Seach users to invite, how ineficient is what I use?


#1

Hi,

I’m using HasManyFriends plugin.

I’m listing friends so users can request friendship. From those I have
to remove the admin, the current user and users that are friends
already.

For that I used this:

def index
@users = User.find(:all)

render :inline =>
"<% for user in @users %>
  <% if !user.has_role?('administrator') && user != current_user &&

(!user.is_friends_with? current_user) %>
<%=h user.login %>
     
<%= link_to ‘Invite this user’, :action => ‘process_invitation’,
:invite => user ,:command => ‘invite’ unless
(user.has_role?(‘administrator’) || user == current_user) %>


<% end %>
<% end %>"
end

I think that’s not the most optimal way.
Any hints how to do it better?

Note, I’m planning to include a city filter for the first user fecth
soon.

Thanks


#2

Any comments anyone?
I guess my code is perfect otherwise :sunglasses:

Maybe I didn’t formulate the right question…

Regards