def show_user_events
user = current_user
@join_events = JoinEvent.find_all_by_user_id(user.id)
# @events = Event.where(:id => @join_events)
respond_to do |format|
format.html # show_user_events.html.erb
format.json { render json: @events }
end
end
I want to get the specific values in the 'Event'. The 'event_id' is one of the attributes of the 'JoinEvent'. Using the 'event_id' values of '@join_events', I want to get the same effect as the command in the SQL query.
SELECT * FROM events
WHERE id in (join_events[1].event_id, join_events[2].event_id, ...)
What should I do to achieve this effect in rails?