i need help with the following topic:
I'm trying to create an array of users based on their ids
def show
@appointment = Appointment.where(:event_id => :id).all
@users = Array.new
@appointment.each do |appointment|
@users.fill(User.find(appointment.user_id))
end
end
First, im getting all appointments which event_id are the same to :id (which comes from the Event table) . Then i proceed to create an array to be filled later with users inside the .each do expression.
The problem is that @users is empty after the expresion ends.
What am i doing wrong?