users_controller.rb 318 Bytes
Newer Older
Dmytro Zaporozhets's avatar
Dmytro Zaporozhets committed
1 2
class UsersController < ApplicationController
  def show
3
    @user = User.find_by_username!(params[:username])
Dmytro Zaporozhets's avatar
Dmytro Zaporozhets committed
4 5 6 7
    @projects = @user.authorized_projects.where('projects.id in (?)', current_user.authorized_projects.map(&:id))
    @events = @user.recent_events.where(project_id: @projects.map(&:id)).limit(20)
  end
end