Forum: Ruby on Rails Seach users to invite, how ineficient is what I use?

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
comopasta G. (Guest)
on 2008-10-16 21:24

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

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 %>
        &nbsp; &nbsp; &nbsp;
        <%= link_to 'Invite this user', :action => 'process_invitation',
:invite => user ,:command => 'invite' unless
(user.has_role?('administrator') || user == current_user) %>
      <% 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

comopasta G. (Guest)
on 2008-10-17 14:38
Any comments anyone?
I guess my code is perfect otherwise 8-)

Maybe I didn't formulate the right question...

This topic is locked and can not be replied to.