im试图根据传递的不同信息从表中显示某些记录,并且如果没有满足任何要求,它将重定向到主页。代码是全部运作,只是想看看其他人会如何解决这个问题有没有更简单的方法来实现这一目标?
if current_user.admin?
@schedules = Schedule.all
elsif current_user.team_id?
@schedules = Schedule.find_all_by_team_id(current_user[:team_id])
else
redirect_to root_path, :status => 301, :alert => "Please contact your club administrator to be assigned to a team."
return
end
被回答过的问题? – 2012-07-20 01:17:58