Simply I have a collection_select which allows a user to select any users that share the same business.id. It uses the list @colleagues created in Ruby:
#events_controller#new
@colleagues = User.where(business_id: current_user.business_id)
#events/new.html.erb
<%= f.collection_select :id,
@colleagues,
:id,
:full_name %>
But at the moment, this list includes the current_user, which I do not want to happen (the user should not be able to select them self). Is there a way I can exclude the current_user from this list from querying the database? I am using SQLite.
Thank you, and any further explanation would be much appreciated as I am new to Ruby and SQL.
Aucun commentaire:
Enregistrer un commentaire